PHP 5.5.37 is released
add a note add a note

User Contributed Notes 2 notes

up
-37
m_ilyas at outlook dot com
3 months 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);
   
?>
up
-206
abubakarwaryah786 at gmail dot com
5 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