3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj = new stdClass; $obj->color = function( $item ){ $arr = ["rose"=>"red", "violet"=>"blue", "grass"=>"green"]; return $arr[$item]; }; $flowers = [0=>"rose",1=>"violet"]; foreach ($flowers as $key => $flower){ echo ucfirst("{$flower}s are "); echo ($obj->color)($flower); echo ($key == 0)? ",\n" : " ...\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 28
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 28
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/scC8X
function name:  (null)
number of ops:  30
compiled vars:  !0 = $obj, !1 = $flowers, !2 = $flower, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    4     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FscC8X%3A4%240'
          4        ASSIGN_OBJ                                               !0, 'color'
   10     5        OP_DATA                                                  ~8
   13     6        ASSIGN                                                   !1, <array>
   15     7      > FE_RESET_R                                       $10     !1, ->28
          8    > > FE_FETCH_R                                       ~11     $10, !2, ->28
          9    >   ASSIGN                                                   !3, ~11
   16    10        INIT_FCALL                                               'ucfirst'
         11        NOP                                                      
         12        FAST_CONCAT                                      ~13     !2, 's+are+'
         13        SEND_VAL                                                 ~13
         14        DO_ICALL                                         $14     
         15        ECHO                                                     $14
   17    16        FETCH_OBJ_R                                      ~15     !0, 'color'
         17        INIT_DYNAMIC_CALL                                        ~15
         18        SEND_VAR_EX                                              !2
         19        DO_FCALL                                      0  $16     
         20        ECHO                                                     $16
   18    21        IS_EQUAL                                                 !3, 0
         22      > JMPZ                                                     ~17, ->25
         23    >   QM_ASSIGN                                        ~18     '%2C%0A'
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~18     '+...%0A'
         26    >   ECHO                                                     ~18
   15    27      > JMP                                                      ->8
         28    >   FE_FREE                                                  $10
   19    29      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FscC8X%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.71 ms | 1400 KiB | 15 Q