Strcmp and string comparison in PHP where string comes from an array -
here's i'm trying achieve, @ moment returns "error", despite $assign
holding value a.
if ($assign === "a") { echo "assign a"; } elseif ($assign === "b") { echo "assign b"; } else { echo "error"; }
$assign
getting value array, shown below checked think of. strcmp
below returns -52, has me stumped. $assignments[0]
holds "a", without extraneous spaces or characters, , type string.
$assign = $assignments[0]; print_r ($assign); print (gettype($assign)); echo strcmp ($assign, "a");
i'm assuming issue i'm not assigning $assign
value "a" instead sort of reference comes array, i'm afraid that's far troubleshooting has gotten me!
Comments
Post a Comment