
Are objects passed by value or by reference?

Hi everyone,
Everything is passed by value.
Example :
<?php
function fruitName($name = "apple")
{
return "Fruit is $name.";
}
echo fruitName();
echo "<br>";
echo fruitName(null);
echo "<br>";
echo fruitName("Strawberry");
?>
Output :
Fruit is apple. Fruit is . Fruit is Strawberry.
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.