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
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: emailleonid at start dot com dot au
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 10:01:29 2024 UTC