Lukas Smith wrote:

> > Our original idea was to handle this with an if statement like so:
> > if (version_compare(phpversion(), "5.0.0") == -1) {
> >     // assign factoried method to this for PHP 4
> >     // $this =& <Your_Package_Name>::factory();

// $this =& <Your_Package_Name>::singleton();
eval('$this =& <Your_Package_Name>::singleton();');

> > } else {
> >     // error handling for PHP5
> >     // user has to use the factory()/singleton() method
> > }
>
> I guess to make it clear, what I want is that PHP5 only explodes if it
> is actually asked to execute an assignement to $this and not just
> because there is one in the constructor. However Derick just messed
> around with the relevant code and didnt immediatly see a solution.

So what's wrong with using eval to evaluate the non-PHP5 compatible code?
Besides the performance penalty, of course.  The code in the eval itself
will never be parsed or executed in PHP5.  Seems to work for me at
least...

> regards,
> Lukas Smith

-Brad

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to