#18840 [Opn->Csd]: Problem in example of in_array()

From: Date: Fri, 09 Aug 2002 23:14:20 +0000
Subject: #18840 [Opn->Csd]: Problem in example of in_array()
References: 1  Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-16413@lists.php.net to get a copy of this message
ID: 18840 Updated by: jmcastagnetto@php.net Reported By: ahristov@icygen.com -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: All PHP Version: 4.2.2 New Comment: This bug has been fixed in CVS. You can grab a snapshot of the CVS version at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2002-08-09 18:32:40] ahristov@icygen.com I think there is a bug in an example on the in_array()'s manual page. Example 3: <?php $a = array(array('p', 'h'), array('p', 'r'), 'o'); if (in_array(array ('p', 'h'), $a)) echo "'ph' is found\n"; if (in_array(array ('f', 'i'), $a)) echo "'fi' is not found\n"; if (in_array('o', $a)) echo "'o' is found\n"; ?> // This will output: 'ph' is found 'o' is found -=-=-=-=-=- Either the message for the second "if" must be : "'fi' is found\n" or the condition must be changed as well as the output if (!in_array(array ('f', 'i'), $a)) Output: 'ph' is found 'fi' is not found 'o' is found Regards, Andrey ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18840&edit=1

« previous php.bugs (#16413) next »