Re: Multiple assignments?
| From: | Ignacio Vazquez-Abrams | Date: | Thu, 14 Dec 2000 23:32:15 +0000 |
| Subject: | Re: Multiple assignments? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30391@lists.php.net to get a copy of this message | ||
On Thu, 14 Dec 2000, Elan wrote:
> Hi,
>
> I thought I'd seen a notation for PHP that allows you to make multiple
> assignments in one line, similar to Python or REBOL. In REBOL you'd say
> set [a b] [1 2]
> whereupon the variable a would be set to the value 1, and the variable b
> would be set to the value 2.
> In Python I think a similar notation would be something like:
>
> a, b = 1, 2
>
> Does PHP support a similar notation, and, if so, what does it look
> like? Or was I dreaming?
>
> TIA,
>
> Elan
>
Try:
list($a, $b)=Array(1, 2);
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>