xref: /PHP-8.2/ext/opcache/tests/opt/sccp_009.phpt (revision e48a5c14)
1--TEST--
2SCCP 009: Conditional Constant Propagation of non-escaping array elements
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.optimization_level=-1
7opcache.opt_debug_level=0x20000
8opcache.preload=
9zend_test.observer.enabled=0
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14function foo(int $x) {
15    $a[0] = $x;
16    $a[1] = 2;
17    echo $a[1];
18}
19?>
20--EXPECTF--
21$_main:
22     ; (lines=1, args=0, vars=0, tmps=0)
23     ; (after optimizer)
24     ; %ssccp_009.php:1-8
250000 RETURN int(1)
26
27foo:
28     ; (lines=3, args=1, vars=1, tmps=0)
29     ; (after optimizer)
30     ; %ssccp_009.php:2-6
310000 CV0($x) = RECV 1
320001 ECHO string("2")
330002 RETURN null
34