3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait theTrait { public function test($a, $x=[]) { if (isset($this->x)) { echo 'prefixed: ' . $a; } else { echo $a; } } } class theClass { use theTrait; protected $x = []; } /* class theExtend extends theClass { public function test($b) { echo 'prefixed: ' . $b; } } */ $x = new theClass; $x->test('test');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dnB3f
function name:  (null)
number of ops:  8
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   DECLARE_CLASS                                            'theclass'
   31     1        NEW                                              $1      'theClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   33     4        INIT_METHOD_CALL                                         !0, 'test'
          5        SEND_VAL_EX                                              'test'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class theTrait:
Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dnB3f
function name:  test
number of ops:  9
compiled vars:  !0 = $a, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
    6     2        ISSET_ISEMPTY_PROP_OBJ                                   'x'
          3      > JMPZ                                                     ~2, ->7
    7     4    >   CONCAT                                           ~3      'prefixed%3A+', !0
          5        ECHO                                                     ~3
    6     6      > JMP                                                      ->8
    9     7    >   ECHO                                                     !0
   12     8    > > RETURN                                                   null

End of function test

End of class theTrait.

Class theClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.53 ms | 998 KiB | 13 Q