Call by Value in PHP with Examples
Program 1
<html> <head><title>PHP For Loops</title> <body> <center> <?php function display() // defination { echo "Data Flair Free Course"; echo "<br>Data Flair Free Certificate course"; } /* function inbuild (derived) userdefine defination calling */ display(); // Calling display(); display(); display(); ?> </center> </body> </html>
Program 2
<html> <head><title>PHP For Loops</title> <body> <center> <?php // function add($a,$b,$c) // { // $d=$a+$b+$c; // echo "<br>Addition is: ".$d; // } function factorial($n) // Parameter { $f=1; while($n!=0) { $f=$f*$n; $n--; } return $f; } //Calling $m=7; $x,$y=factorial($m); //call echo "<br>Factorial of ".$m." is: ".$x; if($x%2==0) echo "<br> Result is even no"; else echo "<br> Result is odd no"; /// palindrom // arsmstrong //factorial(); // call by value (argument) // factorial(7); // factorial(4); // factorial(8); // add(5,3,7); // add(15,20,10); ?> </center> </body> </html>