source: branches/version-2_5-dev/data/module/Compat/tests/function/array_intersect_ukey.phpt @ 19792

Revision 19792, 672 bytes checked in by Seasoft, 13 years ago (diff)

#744(PHP4 互換用途ソースを将来的に切り捨てやすい仕組みづくり)

Line 
1--TEST--
2Function -- array_intersect_ukey
3--SKIPIF--
4<?php if (function_exists('array_intersect_ukey')) { echo 'skip'; } ?>
5--FILE--
6<?php
7require_once 'PHP/Compat.php';
8PHP_Compat::loadFunction('array_intersect_ukey');
9
10function key_compare_func($key1, $key2)
11{
12    if ($key1 == $key2) {
13        return 0;
14    } elseif ($key1 > $key2) {
15        return 1;
16    } else {
17        return -1;
18    }
19}
20
21$array1 = array('blue'  => 1, 'red'  => 2, 'green'  => 3, 'purple' => 4);
22$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan'   => 8);
23
24print_r(array_intersect_ukey($array1, $array2, 'key_compare_func'));
25
26?>
27--EXPECT--
28Array
29(
30    [blue] => 1
31    [green] => 3
32)
Note: See TracBrowser for help on using the repository browser.