Hi all,
My infamous debug class is growing and i am now spawning the parent from the child to get the parent vars and methods for outputting.
The code below is rather crude but does work but is there a better way to append the file extension?
//.....class declared etc etc (remember this works).....
//$debug is the child
$parentClass = get_parent_class($debug);
if($parentClass != "") {
$classLength = strlen($parentClass);
$parentClass = $parentClass . ".php";
$getClassPath = "require_once(\"$parentClass\");";
eval($getClassPath);
//sub string $parentClass back so chop the extension off
$parentClass = substr($parentClass, 0, $classLength);
//the start of the parent object
$parentObject = NULL;
$spawnObject = "\$parentObject = new $parentClass; ";
eval($spawnObject);
//.....get parent vars, methods, manipulate the two arrays
}
Two questions
1. how do I destroy my spawned object?
2. how do I append the file extension better?
Big thanks in advance and I only just realised you have to put resolved when resolved..sorry for other unresolved posts.
BBK
🙂