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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -