php-src/ext/standard/tests/array/array_search.phpt
Antony Dovgal 4948afff78 MFH
2007-06-28 15:27:09 +00:00

30 lines
539 B
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--TEST--
Test array_search()/in_array()
--FILE--
<?php
$arr1 = array('a','b','c');
$arr2 = array();
$arr3 = array('c','key'=>'d');
$arr4 = array("a\0b"=>'e','key'=>'d', 'f');
var_dump(in_array(123, $arr2));
var_dump(in_array(123, $arr1));
var_dump(array_search(123, $arr1));
var_dump(in_array('a', $arr1));
var_dump(array_search('a', $arr1));
var_dump(array_search('e', $arr4));
var_dump(array_search('d', $arr4));
echo "Done\n";
?>
--EXPECTF--
bool(false)
bool(false)
bool(false)
bool(true)
int(0)
string(3) "ab"
string(3) "key"
Done