xref: /PHP-8.4/tests/lang/019.phpt (revision 7aacc705)
1--TEST--
2eval() test
3--FILE--
4<?php
5
6eval("function test() { echo \"hey, this is a function inside an eval()!\\n\"; }");
7
8$i=0;
9while ($i<10) {
10  eval("echo \"hey, this is a regular echo'd eval()\\n\";");
11  test();
12  $i++;
13}
14
15eval('-');
16?>
17--EXPECTF--
18hey, this is a regular echo'd eval()
19hey, this is a function inside an eval()!
20hey, this is a regular echo'd eval()
21hey, this is a function inside an eval()!
22hey, this is a regular echo'd eval()
23hey, this is a function inside an eval()!
24hey, this is a regular echo'd eval()
25hey, this is a function inside an eval()!
26hey, this is a regular echo'd eval()
27hey, this is a function inside an eval()!
28hey, this is a regular echo'd eval()
29hey, this is a function inside an eval()!
30hey, this is a regular echo'd eval()
31hey, this is a function inside an eval()!
32hey, this is a regular echo'd eval()
33hey, this is a function inside an eval()!
34hey, this is a regular echo'd eval()
35hey, this is a function inside an eval()!
36hey, this is a regular echo'd eval()
37hey, this is a function inside an eval()!
38
39Parse error: syntax error, unexpected %s in %s019.php(12) : eval()'d code on line 1
40