[PHP] Assigning one var to multiple vars
Just mostly curious but is there a way to assign one variable to multiple variables in one single line? Rather than do this: $var2 = $var1; $var3 = $var1; Is there a method to perform a: ($var2,$var3) = $var1; -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assigning one var to multiple vars
From: Matthew Sims [EMAIL PROTECTED] Just mostly curious but is there a way to assign one variable to multiple variables in one single line? $a = $b = $c = $d = 1; ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assigning one var to multiple vars
$var2 = $var3 = $var5 = all the same; Jason Matthew Sims [EMAIL PROTECTED] wrote: Just mostly curious but is there a way to assign one variable to multiple variables in one single line? Rather than do this: $var2 = $var1; $var3 = $var1; Is there a method to perform a: ($var2,$var3) = $var1; -- --Matthew Sims --http://killermookie.org -- 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
Re: [PHP] Assigning one var to multiple vars
Matthew Sims wrote: Just mostly curious but is there a way to assign one variable to multiple variables in one single line? Rather than do this: $var2 = $var1; $var3 = $var1; Is there a method to perform a: ($var2,$var3) = $var1; $var1 = $var2 = $var3 = 'some_value'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assigning one var to multiple vars
On Friday 10 September 2004 04:38, Matthew Sims wrote: Just mostly curious but is there a way to assign one variable to multiple variables in one single line? Rather than do this: $var2 = $var1; $var3 = $var1; Is there a method to perform a: ($var2,$var3) = $var1; manual Expressions -- 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 -- /* Nothing astonishes men so much as common sense and plain dealing. -- Ralph Waldo Emerson */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Assigning one var to multiple vars
How about: ? $var1 = $var2 = $var3 = 5; echo $var1 . 'br/' . $var2 . 'br/' . $var3 . 'br/'; ? Regards, Justin -Original Message- From: Matthew Sims [mailto:[EMAIL PROTECTED] Sent: Thursday, September 09, 2004 1:39 PM To: [EMAIL PROTECTED] Subject: [PHP] Assigning one var to multiple vars Just mostly curious but is there a way to assign one variable to multiple variables in one single line? Rather than do this: $var2 = $var1; $var3 = $var1; Is there a method to perform a: ($var2,$var3) = $var1; -- --Matthew Sims --http://killermookie.org -- 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
RE: [PHP] Assigning one var to multiple vars
How about: ? $var1 = $var2 = $var3 = 5; echo $var1 . 'br/' . $var2 . 'br/' . $var3 . 'br/'; ? Regards, Justin I had something stuck in my head between what Python does and PHP's list function. Not sure why I couldn't figure this one out. Thanks all. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assigning one var to multiple vars
* Thus wrote Jason Davidson: $var2 = $var3 = $var5 = all the same; or $var2 = $var3 = $var5 = all the same; Curt -- The above comments may offend you. flame at will. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php