xref: /PHP-8.0/sapi/phpdbg/tests/print_001.phpt (revision b36dbdd1)
1--TEST--
2Basic print functionality
3--INI--
4opcache.enable_cli=0
5--PHPDBG--
6p foo
7p class \Foo\bar
8p
9p e
10q
11--EXPECTF--
12[Successful compilation of %s]
13prompt> [User Function foo (8 ops)]
14L14-16 foo() %s - %s + 8 ops
15 L14   #0     RECV                    1                                         $baz
16 L15   #1     INIT_FCALL%s %d %s "var_dump"
17 L15   #2     INIT_FCALL%s %d %s "strrev"
18 L15   #3     SEND_VAR                $baz                 1
19 L15   #4     DO_%cCALL                                                          @0
20 L15   #5     SEND_VAR                @0                   1
21 L15   #6     DO_%cCALL
22 L16   #7     RETURN<-1>              null
23prompt> [User Class: Foo\Bar (2 methods)]
24L5-7 Foo\Bar::Foo() %s - %s + 5 ops
25 L5    #0     RECV                    1                                         $bar
26 L6    #1     INIT_NS_FCALL_BY_NAME<1>                      "Foo\\var_dump"
27 L6    #2     SEND_VAR_EX             $bar                 1
28 L6    #3     DO_FCALL
29 L7    #4     RETURN<-1>              null
30L9-9 Foo\Bar::baz() %s - %s + 1 ops
31 L9    #0     RETURN<-1>              null
32prompt> [Not Executing!]
33prompt> [Context %s (9 ops)]
34L1-21 {main}() %s - %s + 9 ops
35 L18   #0     NEW                     "Foo\\Bar"                                @0
36 L18   #1     DO_FCALL
37 L18   #2     INIT_METHOD_CALL<1>     @0                   "Foo"
38 L18   #3     SEND_VAL_EX             "test"               1
39 L18   #4     DO_FCALL
40 L19   #5     INIT_FCALL%s %d %s "foo"
41 L19   #6     SEND_VAL                "test"               1
42 L19   #7     DO_FCALL
43 L21   #8     RETURN<-1>              1
44prompt>
45--FILE--
46<?php
47
48namespace Foo {
49	class Bar {
50		function Foo($bar) {
51			var_dump($bar);
52		}
53
54		function baz() { }
55	}
56}
57
58namespace {
59	function foo($baz) {
60		var_dump(strrev($baz));
61	}
62
63	(new \Foo\Bar)->Foo("test");
64	foo("test");
65}
66