xref: /PHP-8.4/ext/opcache/tests/opt/sccp_031.phpt (revision e48a5c14)
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=
9zend_test.observer.enabled=0
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14function foo() {
15    $k = 0;
16    $a = [null];
17    echo isset($a[$k]);
18    echo "b";
19    echo isset($a[$k+1]);
20    echo "c";
21    echo $a[$k];
22    echo $a; // Should not be optimized
23}
24?>
25--EXPECTF--
26$_main:
27     ; (lines=1, args=0, vars=0, tmps=0)
28     ; (after optimizer)
29     ; %ssccp_031.php:1-13
300000 RETURN int(1)
31
32foo:
33     ; (lines=4, args=0, vars=0, tmps=0)
34     ; (after optimizer)
35     ; %s_031.php:2-11
360000 ECHO string("b")
370001 ECHO string("c")
380002 ECHO array(...)
390003 RETURN null
40