Aug 15 2007

PHP Swap (Simple Swapping)

php swapping

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.

TAGS:

1 Comments on this post

Trackbacks

  1. ruX said:

    Good idea :)
    AFIK, this construction needs more memory.

    August 27th, 2008 at 12:55 am

LEAVE A COMMENT

Subscribe Form

Subscribe to Blog

Sponsors

    Itslife Online
    Advt on sajithmr.com
    Advt on sajithmr.com
    Advt on sajithmr.com

Recent Comments

  • Binny V A: Thanks for the post - love the picture ;-)
  • TheAnand: A lot of people are seeing errors with google video chat….is there any other software which has to be...
  • Alex: Wow, interresting analysis you have done! I’m trying to run GoogleVoiceAndVideoSetup on linux, using...
  • Mella Fitriansyah: Nice plugin, I will try to add this plugin in my blog…
  • Mella Fitriansyah: Nice Info, Sir i will reading your another post success for you

Recent Readers

JOIN MY COMMUNITY!

Recent Posts