This is two questions actually,
first I was wondering what the { } meant in PHP ie: what is the difference between $foo and {$foo}? I know what it means when using variable variables & functions but not on it's own.
Second,
Is there a way to build a bit of code with variable operator? as in:
$foo = array('*', '/', '+', '-');
$bar = 2;
$s = sizeof($foo);
for($i=0;$i<$s;$i++){
echo "$bar $foo[$i] $bar =".($bar ($foo[$i]) $bar)."<BR>\n";
}
/*
Would Print (if it worked):
2 * 2 = 4
2 / 2 = 1
2 + 2 = 4
2 - 2 = 0
*/
Is there any way of doing it that doesn't spit out a parse error?
Thanks.
JMJimmy