Aidan Lister wrote:

How _should_ this be done? In terms of "best practice".

<?php
function foobar ()
{
    return new SomeObject;
}
?>

Or:

<?php
function barfoo ()
{
    $tempvar = new SomeObject;
    return $tempvar
}
?>

Please don't reply if you really, really don't know what you are talking
about.

Some earlier versions of PHP5 would not allow returning by reference of a function call or a new call. It was very recently added, but may not be in RC2 (not sure). You had to assign to a variable before you returned.


Here's my 2c:

function &foobar() {
  return new SomeObject;
}

--
paperCrane <Justin Patrin>

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



Reply via email to