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?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to