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 if isset ($_ post submit )) in php?

538


What is difference between session_unset and session_destroy?

502


Explain what is the function file_get_contents() usefull for?

504


Why print_r is used in php?

531


What is super keyword in c++?

579






Are sessions stateless?

484


Does php have future?

576


Does cors prevent csrf?

527


What is php7?

620


What is php written in?

539


How to open a file for reading?

541


where do we use htaccess?

536


Does wordpress run on php 7?

507


What is the function in PHP do not return a timestamp?

563


What is a session in php?

564