3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Полиморфизм :D $objA = [ 'type' => 'A', 'data' => [ 'text' => 'Привет, мир!' ] ]; $objB = [ 'type' => 'B', 'data' => [ 'pieces' => ['Hello', 'world!'] ] ]; function printObj($obj) { call_user_func('printObj' . $obj['type'], $obj['data']); } function printObjA($data) { echo $data['text']; } function printObjB($data) { echo implode(', ', $data['pieces']); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/26SKa
function name:  (null)
number of ops:  3
compiled vars:  !0 = $objA, !1 = $objB
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   27     2      > RETURN                                                   1

Function printobj:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/26SKa
function name:  printObj
number of ops:  8
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        FETCH_DIM_R                                      ~1      !0, 'type'
          2        CONCAT                                           ~2      'printObj', ~1
          3        INIT_USER_CALL                                1          'call_user_func', ~2
          4        FETCH_DIM_R                                      ~3      !0, 'data'
          5        SEND_USER                                                ~3
          6        DO_FCALL                                      0          
   19     7      > RETURN                                                   null

End of function printobj

Function printobja:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/26SKa
function name:  printObjA
number of ops:  4
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        FETCH_DIM_R                                      ~1      !0, 'text'
          2        ECHO                                                     ~1
   23     3      > RETURN                                                   null

End of function printobja

Function printobjb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/26SKa
function name:  printObjB
number of ops:  8
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   26     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 '%2C+'
          3        FETCH_DIM_R                                      ~1      !0, 'pieces'
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                         $2      
          6        ECHO                                                     $2
   27     7      > RETURN                                                   null

End of function printobjb

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.8 ms | 1396 KiB | 15 Q