php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #18840 Problem in example of in_array()
Submitted: 2002-08-09 18:32 UTC Modified: 2002-08-09 19:14 UTC
From: ahristov at icygen dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.2.2 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ahristov at icygen dot com
New email:
PHP Version: OS:

 

 [2002-08-09 18:32 UTC] ahristov at icygen dot 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-09 19:14 UTC] jmcastagnetto@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 19:01:30 2024 UTC