#18840 [NEW]: Problem in example of in_array()

From: Date: Fri, 09 Aug 2002 22:32:41 +0000
Subject: #18840 [NEW]: Problem in example of in_array()
Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-16411@lists.php.net to get a copy of this message
From: ahristov@icygen.com Operating system: All PHP version: 4.2.2 PHP Bug Type: Documentation problem Bug description: Problem in example of in_array() 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 bug report at http://bugs.php.net/?id=18840&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=18840&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=18840&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=18840&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=18840&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=18840&r=support Expected behavior: http://bugs.php.net/fix.php?id=18840&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=18840&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=18840&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=18840&r=globals

« previous php.bugs (#16411) next »