5 thoughts on “PHP Tutorial (& MySQL) #14 – Variable Scope

  • February 25, 2019 at 20:24
    Permalink

    instead of passing by reference can you have the method return the value and set it to name?

    So:
    $name = 'mario'
    $name = sayBye($name);

    function sayBye($name)
    {
    echo 'bye wario';
    return 'wario';
    }

    echo $name; // would this print out wario?

  • February 25, 2019 at 20:24
    Permalink

    Thanks, shaun…i am new to PHP but having fun already with it. please kindly do Laravel tutorial too after this..please ninja come to our rescue. cheers!

  • February 25, 2019 at 20:24
    Permalink

    delicious.. PHP is my first lang and i am using it for almost 2 years but never got the hang of this "by reference parameter" thing you have shown at 7:59. Now finally i can gratefully say that God had sent a ninja to rescue me from this phenomena

Leave a Reply