xref: /PHP-7.2/tests/lang/019.phpt (revision 17ccbeec)
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--EXPECTF--
17hey, this is a regular echo'd eval()
18hey, this is a function inside an eval()!
19hey, this is a regular echo'd eval()
20hey, this is a function inside an eval()!
21hey, this is a regular echo'd eval()
22hey, this is a function inside an eval()!
23hey, this is a regular echo'd eval()
24hey, this is a function inside an eval()!
25hey, this is a regular echo'd eval()
26hey, this is a function inside an eval()!
27hey, this is a regular echo'd eval()
28hey, this is a function inside an eval()!
29hey, this is a regular echo'd eval()
30hey, this is a function inside an eval()!
31hey, this is a regular echo'd eval()
32hey, this is a function inside an eval()!
33hey, this is a regular echo'd eval()
34hey, this is a function inside an eval()!
35hey, this is a regular echo'd eval()
36hey, this is a function inside an eval()!
37
38Parse error: syntax error, unexpected %s in %s019.php(12) : eval()'d code on line 1
39