Skip to main content

Posts

Showing posts with the label Swap Two number Program in PHP

Swap Two number Program in PHP

Swap Two number Program in PHP Swap two number with each other means interchange their value. Suppose you have two number a and b a contain 6 and b contain value 5 after swap their value, a have 5 and b have 6. basically 2 method of interchange value a-using third variable, b-without using third variable(Using Arithmetic Operators), c-usign multiplication, d-bitwaise XOR operation, a-swap two number using third <?php $a=10; $b=20; echo "Value of a: $a</br>"; echo "Value of b: $b</br>"; $a=$a+$b; $b=$a-$b; $a=$a-$b; echo "Value of a: $a</br>"; echo "Value of b: $b</br>"; ?> b-without using third variable(Using Arithmetic Operators), wap two number with each other means interchange their value. Suppose you have two number a and b a contain 10 and b contain value 20 after swap their value, a have 20 and b have 10. <?php $a=10; $b=20; echo "Value of a: $a</b...