Arquivos
hhvm/hphp/test/slow/ext_array/array_unique.php
T
Jordan DeLong 9e127b9831 Rewrite TestExtArray in php
Most of this is ported over, except some omissions:
  - array_filter, array_key_exists (suspected we had coverage already;
    one is a bytecode, and one was rewritten in hhas recently)
  - some random cases distinguishing init_null_variant vs. null_variant
2013-06-18 16:23:18 -07:00

57 linhas
779 B
PHP

<?php
function a() {
$input = array(
"a" => "green",
"red",
"b" => "green",
"blue",
"red"
);
$result = array_unique($input);
var_dump($result);
}
function b() {
$input = array(
4,
"4",
"3",
4,
3
);
$result = array_unique($input);
var_dump($result);
}
function c() {
$input = array(
"a" => "A",
"b" => "C",
0 => "1",
2 => "01",
1 => 1,
"c" => "C"
);
var_dump(array_unique($input, SORT_STRING));
var_dump(array_unique($input, SORT_NUMERIC));
var_dump(array_unique($input, SORT_REGULAR));
}
function d() {
$input = array(
1 => 1,
'a' => 'A',
'b' => 'C',
0 => '1',
2 => '01',
'c' => 'C'
);
var_dump(array_unique($input, SORT_REGULAR));
}
a();
b();
c();
d();