3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myClass { public function __construct(){ echo __CLASS__,"\n"; } } $obj = new myClass; var_dump($obj); $flower = "violet"; $obj->color = function()use($flower){ $arr = ["rose"=>"red", "violet"=>"blue", "grass"=>"green"]; return $arr[$flower]; }; var_dump($obj); echo "...{$flower}s are ",($obj->color)();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8G4Ja
function name:  (null)
number of ops:  23
compiled vars:  !0 = $obj, !1 = $flower
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $2      'myClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    9     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   10     6        ASSIGN                                                   !1, 'violet'
   12     7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F8G4Ja%3A12%240'
          8        BIND_LEXICAL                                             ~8, !1
          9        ASSIGN_OBJ                                               !0, 'color'
   18    10        OP_DATA                                                  ~8
   19    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
   20    14        ROPE_INIT                                     3  ~11     '...'
         15        ROPE_ADD                                      1  ~11     ~11, !1
         16        ROPE_END                                      2  ~10     ~11, 's+are+'
         17        ECHO                                                     ~10
         18        FETCH_OBJ_R                                      ~13     !0, 'color'
         19        INIT_DYNAMIC_CALL                                        ~13
         20        DO_FCALL                                      0  $14     
         21        ECHO                                                     $14
         22      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F8G4Ja%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8G4Ja
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $flower, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   BIND_STATIC                                              !0
   13     1        ASSIGN                                                   !1, <array>
   17     2        FETCH_DIM_R                                      ~3      !1, !0
          3      > RETURN                                                   ~3
   18     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F8G4Ja%3A12%240

Class myClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8G4Ja
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'myClass'
          1        ECHO                                                     '%0A'
    6     2      > RETURN                                                   null

End of function __construct

End of class myClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.45 ms | 1396 KiB | 15 Q