note 43859 deleted from language.operators.assignment by tomsommer
| From: | tomsommer@php.net | Date: | Tue, 06 Jul 2004 18:25:37 +0000 |
| Subject: | note 43859 deleted from language.operators.assignment by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72786@lists.php.net to get a copy of this message | ||
Note Submitter: shyam
----
jeronimo's code works just fine but it DOES create a intermediate variable, i think (am not
sure)...
the array function returns an array... which remains unnamed, since we didnt store the result of the
array function. After the next run of the garbage collector the unnamed array memory is swept.
similar to this the temp variable that was created can be unset. :)
i hope i am right... since i am new to php and am really not familiar with the workings of the
language.
<?
// ...Just swap the values.
list($biggest, $smallest) = array($smallest, $biggest);
/*********************
the array function does create a intermediate variable.
*********************/
?>