- Impact
- 17
php classes
Hi
ok, say I have two classes. how would I let one class use the others functions?
I can extend the class to inherit functions, but I might have 2 or more I want to inherit.
for instance:
I hope that makes sense! I've asked on other forums, but never got a clear answer. hopefully you guys can enlighten me
Hi
ok, say I have two classes. how would I let one class use the others functions?
I can extend the class to inherit functions, but I might have 2 or more I want to inherit.
for instance:
PHP:
class security{
function strip($name){
return trim($name);
}
}
class site{
function checkName($name){
$security->strip($name);
//Check if name available
}
}
$site = new site();
$site->checkName("Todd");
I hope that makes sense! I've asked on other forums, but never got a clear answer. hopefully you guys can enlighten me