I'm new to classes in php and have the following scenario:
whilst working on a larger framework than I'm used to I would like to use a version number for class names stored in a variable declared at the top of a script. Meaning i have tried the following using eval:
<?php
$Version = '001';
class Foo001{
public function bar(){
global $Version;
echo 'Version = '. $Version;
//Just so i can see its working
}
}
class Similar extends eval('Foo'.$Version) {
public funtion blah(){
// etc...
}
}
$Sim = new Similar;
$Sim->bar();
?>
Thought this would be an eval case but obviously it didn't work, cannot find anything on google or a specific post on SO to help.
I have used the {$blah} method for other scenarios and call_user_func etc but have never needed to do this before.
Is this possible or am i just not able to do this?