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"; if (phpversion() >= "7.0.0"){ echo "...{$flower}s are ",($obj->color)(); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 29
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/Ytl8F
function name:  (null)
number of ops:  30
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%2FYtl8F%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        INIT_FCALL                                               'phpversion'
         18        DO_ICALL                                         $13     
         19        IS_SMALLER_OR_EQUAL                                      '7.0.0', $13
         20      > JMPZ                                                     ~14, ->29
   22    21    >   ROPE_INIT                                     3  ~16     '...'
         22        ROPE_ADD                                      1  ~16     ~16, !1
         23        ROPE_END                                      2  ~15     ~16, 's+are+'
         24        ECHO                                                     ~15
         25        FETCH_OBJ_R                                      ~18     !0, 'color'
         26        INIT_DYNAMIC_CALL                                        ~18
         27        DO_FCALL                                      0  $19     
         28        ECHO                                                     $19
   23    29    > > RETURN                                                   1

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

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