[ create a new paste ] login | about

Link: http://codepad.org/I5txkKPg    [ raw code | output | fork ]

php.programmer - PHP, pasted on Apr 13:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
// sample code for variable functions in php5
function me($name)
{
 return 'I am me name ='.$name;
}

function i()
{
 return 'I am i';
}
$funVar = 'i';
echo $funVar()."\n";
$funVar = 'me';
echo $funVar('roy')."\n";

// note this does not work with language constructs
// echo() print() isset() unset() include() require() empty()
$funVar = 'print';
$funvar('i m not getting print');
?>


Output:
1
2
3
4
I am i
I am me name =roy

Fatal error: Function name must be a string on line 20


Create a new paste based on this one


Comments: