xref: /PHP-7.2/sapi/phpdbg/tests/print_001.phpt (revision 2b86a891)
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 (11 ops)]
34L1-21 {main}() %s - %s + 11 ops
35 L4    #0     NOP
36 L14   #1     NOP
37 L18   #2     NEW                     "Foo\\Bar"                                @1
38 L18   #3     DO_FCALL
39 L18   #4     INIT_METHOD_CALL<1>     @1                   "Foo"
40 L18   #5     SEND_VAL_EX             "test"               1
41 L18   #6     DO_FCALL
42 L19   #7     INIT_FCALL%s %d %s "foo"
43 L19   #8     SEND_VAL                "test"               1
44 L19   #9     DO_FCALL
45 L21   #10    RETURN<-1>              1
46prompt>
47--FILE--
48<?php
49
50namespace Foo {
51	class Bar {
52		function Foo($bar) {
53			var_dump($bar);
54		}
55
56		function baz() { }
57	}
58}
59
60namespace {
61	function foo($baz) {
62		var_dump(strrev($baz));
63	}
64
65	(new \Foo\Bar)->Foo("test");
66	foo("test");
67}
68