Mailinglisten-Archive |
Wolfgang wrote: > ${"klasse".$x[1]} = new class; Vorsicht, Virenzüchter unterwegs. class foo { function foo() { echo "bar<hr>"; } function sayHello() { echo "Hello!<hr>"; } } $x = array(emil, otto); ${"foo_".$x[1]} = new foo; $code = sprintf('$foo_%s->sayHello();', $x[1]); eval($code); $class = ${"foo_$x[1]"}; $class->sayHello(); $GLOBALS["foo_$x[1]"]->sayHello(); $classes = array ( $x[1] => ${"foo_$x[1]"} ); $classes[$x[1]]->sayHello(); Ulf
php::bar PHP Wiki - Listenarchive