On Friday 20 June 2003 01:11, dorgon wrote:
> > Maybe, there's a setting for this in php.ini.
>
> yes. there is:
Yes, I know there is ;-) The 'maybe' is maybe you have it set different on the
two systems.
> >>declaration of [runtime function name](). If you would like to enable
> >>call-time pass-by-reference, you can set
> >>allow_call_time_pass_reference to true in your INI file.
> >
> > "pass-by-reference" has not been dropped, it is "Call-time
> > pass-by-reference" which is being deprecated.
>
> so call-time pass-by-reference is giving parameters as reference to
> functions, e.g.
>
> function returnObjectToAccumulator(&$obj) {...}
>
> If this feature is really dropped, how would you implement
> ConnectionPools for DB-connections for instance, or any classes
> managing a set of object and providing them by returning references?
>
> many OOP design patterns (primarily adopted from java) would not be
> possible anymore. I think this would be worth talking about.
>
> Is there any plausible reason for that decision?
"Call-time pass-by-reference"
=============================
function doo($i_may_or_may_not_be_a_reference) {
$i_may_or_may_not_be_a_reference++;
}
$i = 1;
doo($i);
echo $i; // 1
doo(&$i);
echo $i; // 2
// here doo() is not defined to have parameters passed by reference. The
decision on whether to pass by reference is made at run-time, hence call-time
pass-by-reference. It is this behaviour which is being deprecated.
So in the newer versions of PHP if call-time pass-by-reference is disabled and
you wish to pass parameters by reference you'll have to define your functions
accordingly:
function doo(&$i_am_passed_by_reference) { ... }
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Federal grants are offered for... research into the recreation
potential of interplanetary space travel for the culturally disadvantaged.
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php