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 / sangita jain
<?php function swap(){
$a=10;
$b=20;
$b=$b-$a;
$a=$a+$b;
echo $a,$b;
}
swap();
?>
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
What does the scope of variables mean?
What is the difference between echo print and print_r in php?
What is different between software and app
What is the difference between static and dynamic websites?
What is c++ polymorphism?
How do I stop a php script?
How can we create a database using php?
Explain the difference between urlencode and urldecode?
What are the encryption functions in php?
How do you call a constructor for a parent class?
How to connect to mysql from a php script?
Tell me how is the ternary conditional operator used in php?
Tell me how to initiate a session in php?
What is the difference between get and post in php?
Why is php so popular?