Is there some trick to override a class dynamically in PHP?

Posted by user198729 on Stack Overflow See other posts from Stack Overflow or by user198729
Published on 2010-03-11T05:31:48Z Indexed on 2010/03/11 5:33 UTC
Read the original article Hit count: 224

Filed under:
|
|

I have two class named test in two different files,a.php and b.php for instance,the logic is like this:

include('a.php');
$a = new test();
if($somcondition_is_met)
{
    include('b.php');
    $b = new test();
}

Is there some trick to avoid Fatal error: Cannot redeclare class ?

© Stack Overflow or respective owner

Related posts about php

Related posts about class