php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #16726 in_array doesnt allow Array as a search argument
Submitted: 2002-04-22 00:02 UTC Modified: 2002-04-22 02:09 UTC
From: emailleonid at start dot com dot au Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.2.0 OS: winXP
Private report: No CVE-ID: None
 [2002-04-22 00:02 UTC] emailleonid at start dot com dot au
 Below is from documentation of in_array()

$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";


it runs it gice the followign error
Warning: Wrong datatype for first argument in call to in_array in /home/www/vaner/test.php on line 4

Warning: Wrong datatype for first argument in call to in_array in /home/www/vaner/test.php on line 6
'o' is found 

I thought it should allow array as a search argument.
what the...?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-22 02:09 UTC] yohgaki@php.net
It works for me. (PHP 4.2.0/4.3.0)
BTW, Paste _COMPLETE_ script, nobody can be sure which line is line 4 or 6.


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jun 22 13:01:23 2021 UTC