3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myClass { public function __construct(){ echo __CLASS__; } } $obj = new myClass; $flower = "violet"; $obj->clr = "bluish"; $obj->color = function()use($flower){ $arr = ["rose"=>"red", "violet"=>"blue", "grass"=>"green"]; return $arr[$flower]; }; echo "...{$flower}s are ",$obj->clr,"\n"; echo "...{$flower}s are ",$obj->color();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PmQNa
function name:  (null)
number of ops:  25
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        ASSIGN                                                   !1, 'violet'
   11     4        ASSIGN_OBJ                                               !0, 'clr'
          5        OP_DATA                                                  'bluish'
   13     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPmQNa%3A13%240'
          7        BIND_LEXICAL                                             ~8, !1
          8        ASSIGN_OBJ                                               !0, 'color'
   19     9        OP_DATA                                                  ~8
   20    10        ROPE_INIT                                     3  ~10     '...'
         11        ROPE_ADD                                      1  ~10     ~10, !1
         12        ROPE_END                                      2  ~9      ~10, 's+are+'
         13        ECHO                                                     ~9
         14        FETCH_OBJ_R                                      ~12     !0, 'clr'
         15        ECHO                                                     ~12
         16        ECHO                                                     '%0A'
   21    17        ROPE_INIT                                     3  ~14     '...'
         18        ROPE_ADD                                      1  ~14     ~14, !1
         19        ROPE_END                                      2  ~13     ~14, 's+are+'
         20        ECHO                                                     ~13
         21        INIT_METHOD_CALL                                         !0, 'color'
         22        DO_FCALL                                      0  $16     
         23        ECHO                                                     $16
         24      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FPmQNa%3A13%240

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

End of function __construct

End of class myClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.87 ms | 1395 KiB | 13 Q