Re: Fw: [PHP-WIN] Passing by reference...
| From: | Pac mon | Date: | Wed, 02 Jan 2002 04:07:03 +0000 |
| Subject: | Re: Fw: [PHP-WIN] Passing by reference... | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-11262@lists.php.net to get a copy of this message | ||
Understood.. as far as I can answer your question... I'd have to say that yes it does 'break' the 'rule' and that it is still the 'preached' method to avoid such things.
One of the fundamental rules of blackbox programming is that a function should never change the value of a global variable. And there are very compelling reasons why this rule exists. I'm simply suggesting that "passing by reference" as a programming "technique" breaks this fundamental rule.....although I am not suggesting that passing by reference is in itself a "bad thing"....perhaps a necessary evil. All I'm saying is ....have the "rules" changed since I left Uni? Ignatius ----- Original Message ----- From: "Pac mon" <cake27@hotmail.com> To: <php-windows@lists.php.net> Sent: Wednesday, January 02, 2002 2:30 PM Subject: Re: Fw: [PHP-WIN] Passing by reference... Some teachers will say this just because they think students are dumb. The reasoning behind it is that 'if we teach them to pass by reference some other dumb programmer can accidentally change values around and break stuff!' Simpletons!_________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.comIsn't passing by reference a "no-no" is terms of good programming? Atleastthat's what I was told when I studied programming about 12 years ago? Ignatius ----- Original Message ----- From: "Anthony Ritter" <tony@gonefishingguideservice.com> To: <php-windows@lists.php.net> Sent: Tuesday, January 01, 2002 2:40 PM Subject: Re: [PHP-WIN] Passing by reference...passed byMichael Sims wrote in message:argumentYes, that is true. The "tax" function has the ampersand in thelist, which means that any variable that you send to it getsoccurreference. This means that any changes to that variable thatinsidemodifyscopethe function will actually affect the same variable that is in theofthe main script. Without the ampersand, the function will onlyscriptit'sown local copy of the variable and leave the one in the mainbutre-rununaltered. If you remove the ampersand from the above script andit, then the output of the first echo statement should not change,thebesecond one will change to 2500 since the function will no longerphp-list-admin@lists.php.netaltering the variable in the main script. http://www.php.net/manual/en/language.references.pass.php Sorry if I'm not understanding your question....................................... Thanks for the reply Michael. You've answered my question. A happy and healthy new year to you and yours. Tony Ritter -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net For additional commands, e-mail: php-windows-help@lists.php.net To contact the list administrators, e-mail:php-list-admin@lists.php.net-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net For additional commands, e-mail: php-windows-help@lists.php.net To contact the list administrators, e-mail:_________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net For additional commands, e-mail: php-windows-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net