RE: [PHP] Assigning one var to multiple vars
| From: | Justin Palmer | Date: | Thu, 09 Sep 2004 21:07:24 +0000 |
| Subject: | RE: [PHP] Assigning one var to multiple vars | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-196263@lists.php.net to get a copy of this message | ||
How about:
<?
$var1 = $var2 = $var3 = 5;
echo $var1 . '<br/>' . $var2 . '<br/>' . $var3 .
'<br/>';
?>
Regards,
Justin
-----Original Message-----
From: Matthew Sims [mailto:matt@killermookie.org]
Sent: Thursday, September 09, 2004 1:39 PM
To: php-general@lists.php.net
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