Swap variables

Views: 3 Last modified: August 03rd, 2011 Comments: 0

How to swap variables…….? Piece of cake!

$var_1 = 'Variable 1';
$var_2 = 'Variable 2';

list($var_2, $var_1) = array($var_1, $var_2);

echo $var_1 .'&'. $var_2;
VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)
    Bluehost

    Mail this!

    To: From:Sum {2+8} =  
    Anything to add ?

        You must be logged in to post a comment.