php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40082 array_search_keys returns a zero value element
Submitted: 2007-01-09 20:40 UTC Modified: 2007-01-09 22:23 UTC
From: paulnamuag at yahoo dot com Assigned:
Status: Closed Package: Arrays related
PHP Version: 5.2.0 OS: Linux
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: paulnamuag at yahoo dot com
New email:
PHP Version: OS:

 

 [2007-01-09 20:40 UTC] paulnamuag at yahoo dot com
Description:
------------
    $array = array( "field1" => 0, "field2" => "This is a string" );

$result = array_search( "This is a string", $array );

print_r( $result ); // Outputs "field1", not "field2"






Expected result:
----------------
    $array = array( "field1" => 0, "field2" => "This is a string" );

$result = array_search( "This is a string", $array );

print_r( $result ); // Outputs "field2"




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-09 22:23 UTC] iliaa@php.net
Seems to work fine in CVS.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 28 03:00:03 2025 UTC