xref: /PHP-8.0/sapi/phpdbg/tests/print_002.phpt (revision 2b86a891)
1--TEST--
2Relative print commands
3--INI--
4opcache.enable_cli=0
5--PHPDBG--
6b foo
7r
8p
9p o
10q
11--EXPECTF--
12[Successful compilation of %s]
13prompt> [Breakpoint #0 added at foo]
14prompt> string(4) "test"
15[Breakpoint #0 in foo() at %s:15, hits: 1]
16>00015: 		var_dump(strrev($baz));
17 00016: 	}
18 00017:
19prompt> [Stack in foo() (8 ops)]
20L14-16 foo() %s - %s + 8 ops
21 L14   #0     RECV                    1                                         $baz
22 L15   #1     INIT_FCALL%s %d %s "var_dump"
23 L15   #2     INIT_FCALL%s %d %s "strrev"
24 L15   #3     SEND_VAR                $baz                 1
25 L15   #4     DO_%cCALL                                                          @0
26 L15   #5     SEND_VAR                @0                   1
27 L15   #6     DO_%cCALL
28 L16   #7     RETURN<-1>              null
29prompt> [L15 %s INIT_FCALL%s %d %s "var_dump"                                %s]
30prompt>
31--FILE--
32<?php
33
34namespace Foo {
35	class Bar {
36		function Foo($bar) {
37			var_dump($bar);
38		}
39
40		function baz() { }
41	}
42}
43
44namespace {
45	function foo($baz) {
46		var_dump(strrev($baz));
47	}
48
49	(new \Foo\Bar)->Foo("test");
50	foo("test");
51}
52