Pass PHP Variables By Reference Example

Jan 13, 2022 . Admin



Hello Friends,

This article will give you example of how to pass php variables by reference. I explained simply about are php variables passed by reference. This tutorial will give you simple example of php variables passing by reference.

In this post, you'll learn php pass by reference. i will show you simple passing by reference php.

Here i will give you many example of how to pass php variables by reference.

Example:
<?php

    // Function used for assigning new value to $student_infomation variable and printing it
    function student($name,$age,$subject) {

        // asign Values To $student_infomation Variables 
        $student_infomation = "Name : ".$name."
"; $student_infomation .= "Age : ".$age."
"; $student_infomation .= "Subject : ".$subject; // We can also Declare Different Variables for different name,age and subject and print them individualy echo $student_infomation; } // User Declaration Code $name = "Nicesnippets.com"; $age = "21"; $subject = "PHP"; student($name,$age,$subject); ?>
Output:
Name : Nicesnippets.com
Age : 21
Subject : PHP
#PHP