PHP Programing language

How Can Passing by Reference
Previous Home Next
When you pass data to a function, what's really passed is a copy of that data. So, for example, if you pass a variable, a copy is made of that variable, and that copy is actually passed to the function.

For example:

<html>
<head>
<title>Passing Reference to Functions </title>
<body>
<h1>Passing Reference to Functions </h1>
<?php
$value = 4;
echo "Before the call, \$value holds $value <br>";
squarer ($value);
echo "After the call, \$value holds $value <br>";
function squarer (&$number)
{
$number *= $number;
}
?>
</body>
</html>

 

Output:

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: