note 106179 deleted from language.variables.basics by danbrown
| From: | danbrown@php.net | Date: | Mon, 17 Oct 2011 16:25:02 +0000 |
| Subject: | note 106179 deleted from language.variables.basics by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183932@lists.php.net to get a copy of this message | ||
Note Submitter: srilatha dot vundyala at gmail dot com
----
you can also swith two numbers by just using + and - operators
<?php
$a=1;
$b=2;
//these are the two numbers we are going to swap
$a=$a+$b;
$b=$a-$b;
$a=$a-$b;
//the swapped values are
echo $a. PHP_EOL.$b;
?>
/*output will be
2
1*/