[PHP] allow_call_time_pass_reference?

2003-08-30 Thread Armand Turpel
Hi,
Why allow_call_time_pass_reference is deprecated? I mean it should be the
choice of the programmer to make use of  pass by reference or not.

Example:

$this_string = $is_really_big   // lets say 500 kb

function ($this_string){} // Here the function takes a copy of $this_string
(500 kb) - in php4

function ( $this_string){} // Here the function takes only the address of
$this_string (I guess an int value)

Make use of the second function is less memory intense. So again. Why this
feature should be deprecated? And why (the nonsens!) to give hostmasters the
possibility to switch this off in the php.ini?

Thanks

atu

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



Re: [PHP] allow_call_time_pass_reference?

2003-08-30 Thread Curt Zirzow
* Thus wrote Armand Turpel ([EMAIL PROTECTED]):
 Why allow_call_time_pass_reference is deprecated? I mean it should be the
 choice of the programmer to make use of  pass by reference or not.
 
 Example:
 
 $this_string = $is_really_big   // lets say 500 kb
 
 function ($this_string){} // Here the function takes a copy of $this_string
 (500 kb) - in php4
 
 function ( $this_string){} // Here the function takes only the address of
 $this_string (I guess an int value)
 
 Make use of the second function is less memory intense. So again. Why this
 feature should be deprecated? And why (the nonsens!) to give hostmasters the
 possibility to switch this off in the php.ini?

You aren't understanding what that flag does:

php.ini
; - allow_call_time_pass_reference = Off [Code cleanliness]
;  It's not possible to decide to force a variable to be passed by reference
; when calling a function.  The PHP 4 style to do this is by making the
; function require the relevant argument by reference.
/php.ini

This flag does not apply to what you have above. What this disables
is the ablity to decide at 'call time', of the function, to pass by
reference or not. This was an old method and changed in php 4:


function foo($bar) { }
foo($mybar); // this is what it doesn't allow.


It is up to the function to declare if you want to pass by
reference or not, this is not depricated:

function foo_reference($bar) { }
function foo_copy($bar) { }


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] allow_call_time_pass_reference?

2003-08-30 Thread Armand Turpel
Thanks for this clarification!

atu




- Original Message - 
From: Curt Zirzow [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, August 30, 2003 6:10 PM
Subject: Re: [PHP] allow_call_time_pass_reference?


 * Thus wrote Armand Turpel ([EMAIL PROTECTED]):
  Why allow_call_time_pass_reference is deprecated? I mean it should be
the
  choice of the programmer to make use of  pass by reference or not.
 
  Example:
 
  $this_string = $is_really_big   // lets say 500 kb
 
  function ($this_string){} // Here the function takes a copy of
$this_string
  (500 kb) - in php4
 
  function ( $this_string){} // Here the function takes only the address
of
  $this_string (I guess an int value)
 
  Make use of the second function is less memory intense. So again. Why
this
  feature should be deprecated? And why (the nonsens!) to give hostmasters
the
  possibility to switch this off in the php.ini?

 You aren't understanding what that flag does:

 php.ini
 ; - allow_call_time_pass_reference = Off [Code cleanliness]
 ;  It's not possible to decide to force a variable to be passed by
reference
 ; when calling a function.  The PHP 4 style to do this is by making
the
 ; function require the relevant argument by reference.
 /php.ini

 This flag does not apply to what you have above. What this disables
 is the ablity to decide at 'call time', of the function, to pass by
 reference or not. This was an old method and changed in php 4:


 function foo($bar) { }
 foo($mybar); // this is what it doesn't allow.


 It is up to the function to declare if you want to pass by
 reference or not, this is not depricated:

 function foo_reference($bar) { }
 function foo_copy($bar) { }


 Curt
 -- 
 I used to think I was indecisive, but now I'm not so sure.

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





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



[PHP] allow_call_time_pass_reference

2001-07-26 Thread andreas \(@work\)

someone got a documentation for this ?


andreas