- mt_rand: documentation ( source)
<?php
class Foo {
function f() {
return 'I am foo';
}
}
class Bar {
function f() {
return 'I am bar';
}
}
if ( mt_rand(0,1) == 0 ) {
$classname = 'Foo';
}
else {
$classname = 'Bar';
}
$obj = new $classname();
echo $obj->f();