function test1() { function __php__say_hi($name) { return 'hi ' . $name; } echo "Test that function named __php__funcname is callable as funcname()<br>\n"; echo 'result: ' . (say_hi('Dave') === 'hi Dave' ? 'pass' : 'fail') . "<br><br>\n\n"; }
function test1() { function say_hi($fname = 'John', $lname = 'Doe') { return "hi {$fname} {$lname}"; } $result1 = say_hi(); $result2 = say_hi('Daffy', 'Duck'); echo "Test that default function parameters work as expected.<br>\n"; echo 'result: ' . ($result1 == 'hi John Doe' && $result2 == 'hi Daffy Duck' ? 'pass' : 'fail') . "<br><br>\n\n"; }