return value from a function - not working
Posted: Sun Jan 03, 2010 8:44 pm
I have read and re-read tutorials on user defined functions and how to pass values to and from but must have missed something. This code returns an error rather than the string that it reverses. Would appreciate some help.
Code: Select all
<?php
/* function to reverse characters in a string */
//
function nameReverse($name){
$newname=strrev($name);
return $newname; //(should return "miJ")
}
//
$name="Jim";
nameReverse($name);
print "the new name is". $newname;
?>