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]; }; phpversion() >= "7.0.0" or die(); echo "...{$flower}s are ",($obj->color)();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RIDG4
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%2FRIDG4%3A13%240'
          7        BIND_LEXICAL                                             ~8, !1
          8        ASSIGN_OBJ                                               !0, 'color'
   19     9        OP_DATA                                                  ~8
   20    10        INIT_FCALL                                               'phpversion'
         11        DO_ICALL                                         $9      
         12        IS_SMALLER_OR_EQUAL                              ~10     '7.0.0', $9
         13      > JMPNZ_EX                                         ~10     ~10, ->16
         14    > > EXIT                                                     
         15*       BOOL                                             ~10     <true>
   21    16    >   ROPE_INIT                                     3  ~12     '...'
         17        ROPE_ADD                                      1  ~12     ~12, !1
         18        ROPE_END                                      2  ~11     ~12, 's+are+'
         19        ECHO                                                     ~11
         20        FETCH_OBJ_R                                      ~14     !0, 'color'
         21        INIT_DYNAMIC_CALL                                        ~14
         22        DO_FCALL                                      0  $15     
         23        ECHO                                                     $15
         24      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FRIDG4%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RIDG4
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%2FRIDG4%3A13%240

Class myClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RIDG4
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:
153.08 ms | 1392 KiB | 15 Q