I don't know what to do


#1

here is my code
function displayname($mido) {
return ($mido);
}
displayName($mido)
error is
Undefined variable: mido (line 10)
i really dont know what to do so please help me


#2

you ought to do this

<?php
     function displayname($mido){
         return $mido;
     }
     // now we come down to calling the function
     //because we are returning  a value in our function we need to pass it as an argument
     //to echo or print to seethe result like this
     echo displayname("Your Name");

    //=============================or============================
    // you can define a variable an pass it as an argument to displayname() function
    // like this
    $mido = "Your name";
    echo displayname($mido);

?>

Now you see that's why you get that error because you have passed $mido to the function call but $mido is not defined.
the $mido you created when you were creating the function

function displayname($mido)

is only valid or local to the method only(i.e. in between the { } of the method) not outside of it.

hope it helped


#3

so what do i need to do an btw this is what i have now
function returnName($name) {
return $name;
}
returnName("Mido");
echo returnName("Mido");