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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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 May 27 05:01:31 2024 UTC