On Fri, 2007-04-06 at 12:19 -0400, Shu Chow wrote:
> Has anyone tried to assign a default value of null for an object passed
> by reference in PHP4?
>
> Let's say I had this code:
>
> $mObj = new testModel();
> $mObj->msg = "Bubba";
>
> testFunc();
>
> class testModel {
> var $msg;
> }
>
> function testFunc(&$msg=null) {
> echo $msg->msg;
> }
>
> Under PHP5, this works fine.
>
> Under PHP4, the "=" will cause an error: Parse error: syntax error,
> unexpected '=', expecting ')'. Removing the "&" in the parameter
> definition makes it work. I'm using 4.4.2 right now, but don't see
> anything in the later change logs that say this was fixed. I also don't
> find any mention of it in the bugs list. Is this a legit bug or am I
> committing a big no-no?
Not a bug, it's a limitation of PHP4.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php