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
Ads