blacksmoke26 Posted November 14, 2009 Share Posted November 14, 2009 I have problem in my code: $edb = array ("s" => "File {NAME} does not exist."); if (!in_array("s", $edb)) { echo ('Error: 10: Number ' . 's' . ' not found in error list.'); } Output: Error: 10: Number s not found in error list. can anyone tell me where is an error? :'( Quote Link to comment Share on other sites More sharing options...
ram4nd Posted November 14, 2009 Share Posted November 14, 2009 Yes and what should it be? Quote Link to comment Share on other sites More sharing options...
blacksmoke26 Posted November 14, 2009 Author Share Posted November 14, 2009 Element 's' is exist in $edb array! then why am getting message .... Element not found Quote Link to comment Share on other sites More sharing options...
ram4nd Posted November 14, 2009 Share Posted November 14, 2009 use print_r on $edb Quote Link to comment Share on other sites More sharing options...
Alex Posted November 14, 2009 Share Posted November 14, 2009 in_array() checks the values of an array, not the keys. Instead use array_key_exists() Quote Link to comment Share on other sites More sharing options...
blacksmoke26 Posted November 14, 2009 Author Share Posted November 14, 2009 Oh yes... i upgraded my PHP to 5.3.0 from PHP 5.2.9. but this was working in PHP 5.2.9. Thanks AlexWD , your the rock... Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted November 14, 2009 Share Posted November 14, 2009 Oh yes... i upgraded my PHP to 5.3.0 from PHP 5.2.9. but this was working in PHP 5.2.9. Thanks AlexWD , your the rock... just tested in 5.2.9-1 and it doesn't work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.