hiphop-php /hphp/test/slow/ext_array/array_unique.php

Language PHP Lines 57
MD5 Hash f46556601791ca6a6522cd1a50725cda Estimated Cost $1,163 (why?)
Repository git://github.com/facebook/hiphop-php.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?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();
Back to Top