Simple question really. More or less another micro-brenchmarking question due to pure curiousity!
But, does creating a function use more resource (memory and/or CPU) in PHP?
Here's an example:
function test()
{
return 1+1;
}
echo test();
vs.
echo 1+1;
Which also brings me to my second ponder! Would containing local variables have any impact too?
Example:
function test()
{
$var = 1+1;
return $var;
}
echo test();
vs.
function test()
{
return 1+1;
}
$var = test();
echo $var;
vs.
function test()
{
return 1+1;
}
echo test();