Created
June 17, 2013 12:07
-
-
Save pmgupte/5796407 to your computer and use it in GitHub Desktop.
Many of the times we face a typical question in interviews: “swap two variables without using third variable”. well, when I ask the same question while interviewing any candidate for PHP, I get the same typical answer of adding and subtracting the two variables. But when I ask them to do it with only one executable statement, they simply can’t. …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a=10; $b=20; | |
list($b, $a) = array($a,$b); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment