prateek prateek - 4 months ago 14
PHP Question

PHP undefined variable and function name must be a string error

$A="67452301";
$B="EFCDAB89";
$C="98BADCFE";
$D="10325476";

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;
}

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


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

Answer

Only call function using its name

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

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