1. Write a function to swap two values ?
$a = 10;
$b = 20;
echo $a, $b;
swap(); // If u want u can pass parameters
echo $a, $b; // It should print 20 , 10
Answer Posted / sunil kumar
<?php
$a = 10;
$b = 20;
echo $a, $b;
$a=$a+$b;
$b=$a-$b;
$a=$a-$b;
echo "<br>";
echo $a, $b;
?>
Is This Answer Correct ? | 9 Yes | 2 No |
Post New Answer View All Answers
What is the integer?
How long should a session last?
What does $_server mean?
What is $_ env in php?
What is explode() in php?
What does explode do in php?
Tell me how can we define a variable accessible in functions of a php script?
What is the use of explode() function?
What is __ construct in php?
Is variable name casesensitive in php?
What is null value in php?
What is the difference between php 5 and php 7?
Tell me what does pear stands for?
is that "enumerated array" equal to "numeric array"?
What is the difference between for and foreach loop in php?