Aug 15 2007
PHP Swap (Simple Swapping)
- 1 Comment
![]()
PHP Simple Swap >>
Hello programmers,
You know list function in php and array function. Just
type like below for swapping two variables $a and $b.
| list($b,$a) = array($a,$b); |
The above code is equivalent to:
$temp = $a;
$a = $b ;
$b= $temp;
Here we shorten the three line of code into a single line.
1 Comments on this post
Trackbacks
-
ruX said:
Good idea

AFIK, this construction needs more memory.August 27th, 2008 at 12:55 am




