php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #21351 in_array return false if not array
Submitted: 2003-01-02 14:47 UTC Modified: 2003-01-02 16:08 UTC
From: marc at rushland dot net Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.2.1 OS: All
Private report: No CVE-ID: None
 [2003-01-02 14:47 UTC] marc at rushland dot net
When you pass a non-array as the second arguement (i.e. the haystack) to
in_array(), I think it would be more useful if PHP simply returned FALSE,
instead of issuing a WARNING error.

Checking an array against is_array() before calling in_array() in a
conditional expression only leads to more complicated code when I think it
is quite logical for PHP to simply return false.

Marc.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-02 15:30 UTC] marc at rushland dot net
This is an accidental duplicate of #21350.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC