Not possible in PHP (i guess), but you can use the List-Array data structure
tandem.
<?php
list($eeny, $meeny, $miney, $mo) = array(1+1, 1*2, pow(1,2), 1/1);
echo "$eeny $meeny $miney $mo<br/>"; // when using web
//printf("%s %s %s %s\n", $eeny, $meeny, $miney, $mo); // when using CLI
list($eeny, $meeny, $miney, $mo) = array($mo, $meeny, $miney, $eeny);
echo "$eeny $meeny $miney $mo<br/>"; // when using web
//printf("%s %s %s %s \n", $eeny, $meeny, $miney, $mo); // when using CLI
?>
On Tue, Feb 15, 2011 at 12:26 AM, botp <[email protected]> wrote:
> On Mon, Feb 14, 2011 at 11:35 PM, hard wyrd <[email protected]> wrote:
> > Can your language do this?
> >> eeny,meeny,miney,mo=1+1,1*2,1^10,1/1
> >> print(eeny,meeny,miney,mo)
> > 2 2 1 1
> >> eeny,meeny,miney,mo=mo,meeny,miney,eeny
> >> print(eeny,meeny,miney,mo)
> > 1 2 1 2
>
> ah, parallel assignments,
>
> eeny,meeny,miney,mo=1+1,1*2,1^10,1/1
>
> [eeny,meeny,miney,mo]
> #=> [2, 2, 11, 1]
>
> eeny,meeny,miney,mo=mo,meeny,miney,eeny
>
> [eeny,meeny,miney,mo]
> #=>[1, 2, 11, 2]
>
>
> the diff is that in ruby, the "^" is an exclusive-or operator
> eg,
>
> 0^0
> #=> 0
> 0^1
> #=> 1
> 1^0
> #=> 1
> 1^1
> #=> 0
>
> for power notation, use "**", eg
>
> 2**8
> #=> 256
>
>
> now, try something like this,
>
> x,*y,z=[1,3,5,9,2]
>
> x
> #=> 1
> y
> #=> [3, 5, 9]
> z
> #=> 2
>
>
> best regards
> -botp
> _________________________________________________
> Kagay-Anon Linux Users' Group (KLUG) Mailing List
> [email protected] (http://lists.linux.org.ph/mailman/listinfo/klug)
> Searchable Archives: http://archives.free.net.ph
>
--
バルヨス リドアン
BALUYOS, Ridvan Lakas ng Bayan S.
http://ridvan.baluyos.net
_________________________________________________
Kagay-Anon Linux Users' Group (KLUG) Mailing List
[email protected] (http://lists.linux.org.ph/mailman/listinfo/klug)
Searchable Archives: http://archives.free.net.ph