prateek prateek - 3 months ago 10x
PHP Question

PHP undefined variable and function name must be a string error


function F($X, $Y, $Z)
$X = hexdec($X);
$Y = hexdec($Y);
$Z = hexdec($Z);
$calc = (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
return $calc;

echo $cal;

i keep getting an error. Undefined variable: F and that function name must be a string.


Only call function using its name

You do not need to add $ before any function name:

$cal = F($B,$C,$D);