xref: /PHP-8.4/ext/opcache/tests/jit/gh12512_2.phpt (revision c60c2a0d)
1--TEST--
2GH-12512: missing type store
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6--FILE--
7<?php
8function foo(array $a, $exit) {
9	$n = 0;
10
11    $count = count($a);
12    if ($count == 0) {
13        return 0;
14    }
15    $a2 = [];
16    foreach ($a as $v) {
17        $a2[] = $v;
18    }
19
20    $count = $a2[5];
21
22    for ($i = 0; $i < $count; $i++) {
23        $x = $a[$i];
24        for ($k = $i + 1; $k < $count; $k++) {
25            $y = $a[$k];
26            $n += $x > $y;
27        }
28	    if ($exit) {
29	    	return $n;
30	    }
31    }
32
33    return $n;
34}
35var_dump(foo([1,2,3,4,5,6,7,8], 1));
36var_dump(foo([1,2,3,4,5,6,7,8], 1));
37var_dump(foo([1,2,3,4,5,6,7,8], 0));
38?>
39DONE
40--EXPECT--
41int(0)
42int(0)
43int(0)
44DONE
45