Call by Reference in PHP Example

Call by Reference in PHP Example. A Php program to execute the call by reference. By using this program we can program using the call by reference function in PHP. Users can define their own functions in PHP. A user-defined function declaration begins with the keyword function and ends with the brackets, which contain all of the code.

function merger(&$str2)
$str2 .= 'Call By Reference';
$str = 'Hello ';
echo $str;



Hello Call By Reference

Call by Reference in Php

When giving arguments to a function via reference, the address of an argument is copied into the formal parameter. The address is utilized within the function to obtain the actual parameter used in the call. Argument pointers are supplied to routines like any other value to pass a value by reference.

Types of strings in php

It’s also one of the data types that the PHP programming language really supports. Alphanumeric characters are allowed in strings. It can be made in a variety of methods, as stated below: You may assign a string to a character after declaring a variable. Strings are a type of linguistic construct that may be used to assist capture words.