PHP Call By ValuePHP allows you to call function by value and reference both. In case of PHP call by value, actual value is not modified if it is modified inside the function. Let's understand the concept of call by value by the help of examples. Example 1In this example, variable $str is passed to the adder function where it is concatenated with 'Call By Value' string. But, printing $str variable results 'Hello' only. It is because changes are done in the local variable $str2 only. It doesn't reflect to $str variable. Output: Hello Example 2Let's understand PHP call by value concept through another example. Output: 10
Next TopicPHP Call By Reference
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week