darkninja_com Posted January 31, 2007 Share Posted January 31, 2007 This text is taken from the file php.ini[color=brown]; Whether to enable the ability to force arguments to be passed by reference; at function call time. This method is deprecated and is likely to be; unsupported in future versions of PHP/Zend. The encouraged method of; specifying which arguments should be passed by reference is in the function; declaration. You're encouraged to try and turn this option Off and make; sure your scripts work properly with it in order to ensure they will work; with future versions of the language (you will receive a warning each time; you use this feature, and the argument will be passed by value instead of by; reference).allow_call_time_pass_reference = Off[/color]Many of mine scripts don't work when this option turned off. Those that send variable through forms or links. How can I process with form Posted data without this turning on?Thank you for reading, please help Link to comment https://forums.phpfreaks.com/topic/36487-how-to-avoid-using-allow_call_time_pass_reference/ Share on other sites More sharing options...
toplay Posted January 31, 2007 Share Posted January 31, 2007 The PHP community is trying to stop people passing by reference like this:function myFunc ($arg) {}$myVar = 'a value';myFunc(&$myVar);The above will work if you have allow_call_time_pass_reference = on.The proper approach now is to define that a variable should be passed by reference right in the function argument declaration like so:function myFunc (&$arg) {} // declare pass by reference for $arg$myVar = 'a value';myFunc($myVar); // don't use "&" when calling functionThe above will work with allow_call_time_pass_reference = off Link to comment https://forums.phpfreaks.com/topic/36487-how-to-avoid-using-allow_call_time_pass_reference/#findComment-173680 Share on other sites More sharing options...
darkninja_com Posted January 31, 2007 Author Share Posted January 31, 2007 Thank you. Link to comment https://forums.phpfreaks.com/topic/36487-how-to-avoid-using-allow_call_time_pass_reference/#findComment-173803 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.