|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-12-26 15:37 UTC] reeze@php.net
[2012-12-26 15:37 UTC] reeze@php.net
-Status: Open
+Status: Feedback
-Package: Compile Warning
+Package: Scripting Engine problem
[2013-01-08 03:19 UTC] aharvey@php.net
[2013-01-08 03:19 UTC] aharvey@php.net
-Status: Feedback
+Status: Not a bug
-Package: Scripting Engine problem
+Package: Arrays related
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
Description: ------------ in_array() function cannot deal with an array that has been declared in an included script , and the compiler shows ths warning : "PHP Warning: in_array() expects parameter 2 to be array, null given in ..." Test script: --------------- we have 2 files file 1 ( arrayFile.php ) ---------------------------- <?php $languages = array('en','fr','es','it','ar','in','ru','jp'); ?> ---------------------------- file 2 ( index.php ) ---------------------------- <?php require_once('arrayFile.php'); $language = 'ar'; if(in_array($language,$languages)) { print "200 OK"; } else { print "404 not found"; } ?> Expected result: ---------------- i expect that in_array() function returns true while the value of $language is available in $languages directory ! Actual result: -------------- Returns nothing and provides this warning : "PHP Warning: in_array() expects parameter 2 to be array, null given in ..."