Hi friends i am new to php , and i am trying to learn classes
i am trying the following code with which i get all functions *name* described in the class
can anybody tell me how can i print the output of functions in the class
<?php
class dog {
public function bark() {
print "Woof!\n";
}
public function legs() {
print "four!\n";
}
}
class poodle extends dog {
public function yip() {
print "Yipppppppp!\n";
}
}
$poppy = new poodle;
//$poppy->bark();
$class_methods = get_class_methods(new poodle());
//echo $class_methods;
foreach($class_methods as $class_methods1)
{
echo $class_methods1.'<br/>';
}
?>
This should work:
In general:
If you have a value like
$test = "abc"you can evaluate it (in php) to either a variablename, or a function etc.: