note 43859 added to language.operators.assignment
| From: | shyam at rn2 dot php dot net | Date: | Tue, 06 Jul 2004 17:38:30 +0000 |
| Subject: | note 43859 added to language.operators.assignment | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-72777@lists.php.net to get a copy of this message | ||
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.
*********************/
?>
----
Manual Page -- http://www.php.net/manual/en/language.operators.assignment.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43859
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43859&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43859&report=yes
Search -- http://master.php.net/manage/user-notes.php