Swap variable values in php
<?php
$a = 40;
$b = 50;
$temp = $a;
$a = $b;
$b = $temp;
echo $a;
echo $b;
OR
Swap values without third variable
$a = 40;
$b = 50;
$a = $a+$b;
$b = $a - $b;
$a = $a - $b;
echo $a;
echo $b;
?>
Magento, OpenCart, Joomla, wordpress, PHPBB, Core PHP, jQuery, Javascript professional elancer.
Home » Posts filed under Interview