php - array does not check the other array -


My code does not work, it does not check, what can I do?

  $ Ex_requests = explosion (',', "1,2"); If (in_array ($ ex_requests, array ('1', '2'))) {echo "OK"; } Else {exit; }  

blank page

when you type < as needle (first parameter, items to search) to in_array () , the haystack (second parameter, items to search) must be an array of arrays . In your case, the following will work:

  $ ex_requests = explosion (',', "1,2"); // In the next line, the first argument is an array / and the second argument is array of arrays ... if (in_array ($ ex_requests, array (array ('1', '2'))) {echo "ok"; } Else {Echo "Not OK";}  

This will print exactly as expected.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -