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


Please Help Members By Posting Answers For Below Questions

What is the integer?

680


How long should a session last?

599


What does $_server mean?

643


What is $_ env in php?

627


What is explode() in php?

647






What does explode do in php?

654


Tell me how can we define a variable accessible in functions of a php script?

605


What is the use of explode() function?

683


What is __ construct in php?

628


Is variable name casesensitive in php?

623


What is null value in php?

647


What is the difference between php 5 and php 7?

566


Tell me what does pear stands for?

658


is that "enumerated array" equal to "numeric array"?

2127


What is the difference between for and foreach loop in php?

714