xref: /PHP-7.4/ext/opcache/tests/opt/sccp_005.phpt (revision 12edc453)
1--TEST--
2SCCP 005: 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=
9--SKIPIF--
10<?php require_once('skipif.inc'); ?>
11--FILE--
12<?php
13function foo(int $x) {
14	$a = [1,2,$x];
15	echo $a[1];
16}
17?>
18--EXPECTF--
19$_main: ; (lines=1, args=0, vars=0, tmps=0)
20    ; (after optimizer)
21    ; %ssccp_005.php:1-7
22L0 (7):     RETURN int(1)
23
24foo: ; (lines=3, args=1, vars=1, tmps=0)
25    ; (after optimizer)
26    ; %ssccp_005.php:2-5
27L0 (2):     CV0($x) = RECV 1
28L1 (4):     ECHO int(2)
29L2 (5):     RETURN null
30