3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myClass { } $obj = new myClass; $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/ZDHBZ
function name:  (null)
number of ops:  20
compiled vars:  !0 = $obj, !1 = $flower
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $2      'myClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    7     3        ASSIGN                                                   !1, 'violet'
    8     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FZDHBZ%3A8%240'
          5        BIND_LEXICAL                                             ~7, !1
          6        ASSIGN_OBJ                                               !0, 'color'
   14     7        OP_DATA                                                  ~7
   15     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   16    11        ROPE_INIT                                     3  ~10     '...'
         12        ROPE_ADD                                      1  ~10     ~10, !1
         13        ROPE_END                                      2  ~9      ~10, 's+are+'
         14        ECHO                                                     ~9
         15        FETCH_OBJ_R                                      ~12     !0, 'color'
         16        INIT_DYNAMIC_CALL                                        ~12
         17        DO_FCALL                                      0  $13     
         18        ECHO                                                     $13
         19      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FZDHBZ%3A8%240

Class myClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.3 ms | 1395 KiB | 15 Q