PHP 7.0.6 Released

User Contributed Notes

m_ilyas at outlook dot com
1 month ago
\\Here is simplest php function example
<?php
   
function swap($a,$b){
        print
nl2br("Before swapping\n");
        print
nl2br("a = $a and b = $b \n\n\n");
       
$a = $a + $b; // 30 = 10 + 20
       
$b = $a - $b;
       
$a = $a - $b;
        print
nl2br("After swapping\n");
        print
nl2br("a = $a and b = $b \n");
    }
   
swap(10,20);
   
?>
abubakarwaryah786 at gmail dot com
3 months ago
if the value of the argument within the function is changed, it does not get changed outside of the function.

$a=10;
$b=13;
function add($a,$b){
    echo "The Sum of $a+$b= ", $a+$b, "<br />";
    $a=5;
    $b=10;
    echo "The sum is=" ,$a+$b , "<br />" ;    }
add($a,$b);
echo $a+$b;
To Top