3v4l.org

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

Function %00%7Bclosure%7D%2Fin%2FqCSLC%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qCSLC
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        FETCH_THIS                                       $1      
          2        FETCH_OBJ_R                                      ~2      $1, 'arr'
          3        FETCH_DIM_R                                      ~3      ~2, !0
          4      > RETURN                                                   ~3
   16     5*     > RETURN                                                   null

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

Class myClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.63 ms | 1392 KiB | 15 Q