ted_chou12 Posted January 25, 2007 Share Posted January 25, 2007 i used a function: $result = array_keys($array1, $id);and I used $result[0] obtains the first figure of the result outputted, looks like:[code]Array ( [0] => color [1] => size )[/code]So in the case above, color will be outputed...although the echo $result[0] works perfectly fine (i got expected result) however, when I want to plug this output value to a if statement, it doesnt work:if ($result[0] != "") {echo "test".$result[0]."test";}it simply does not recognize the value, i dont understand, because the if clause does not differenciate between "..."(some value) and ""(no value).Hope it is understandable.ThanksTed Link to comment https://forums.phpfreaks.com/topic/35659-if-function-does-not-work-correctly/ Share on other sites More sharing options...
Jenk Posted January 25, 2007 Share Posted January 25, 2007 Post your code. Link to comment https://forums.phpfreaks.com/topic/35659-if-function-does-not-work-correctly/#findComment-168912 Share on other sites More sharing options...
ted_chou12 Posted January 25, 2007 Author Share Posted January 25, 2007 nevermind, i solved it, since mine was numeric, so i have to put double quotes on.Ted Link to comment https://forums.phpfreaks.com/topic/35659-if-function-does-not-work-correctly/#findComment-168925 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.