xref: /PHP-8.1/ext/opcache/tests/opt/sccp_031.phpt (revision e9f783fc)
1--TEST--
2SCCP 031: Echo optimizations
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.optimization_level=-1
7opcache.opt_debug_level=0x20000
8opcache.preload=
9--EXTENSIONS--
10opcache
11--FILE--
12<?php
13function foo() {
14    $k = 0;
15    $a = [null];
16    echo isset($a[$k]);
17    echo "b";
18    echo isset($a[$k+1]);
19    echo "c";
20    echo $a[$k];
21    echo $a; // Should not be optimized
22}
23?>
24--EXPECTF--
25$_main:
26     ; (lines=1, args=0, vars=0, tmps=0)
27     ; (after optimizer)
28     ; %ssccp_031.php:1-13
290000 RETURN int(1)
30
31foo:
32     ; (lines=4, args=0, vars=0, tmps=0)
33     ; (after optimizer)
34     ; %s_031.php:2-11
350000 ECHO string("b")
360001 ECHO string("c")
370002 ECHO array(...)
380003 RETURN null
39