3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function count($arr) { echo "I am called each time.\n"; return count($arr); } } $test = new Test(); $arr = array(1,2,3,4,5); for($i=0; $i < $test->count($arr); ++$i) { echo $arr[$i] . "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 6
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 6
Branch analysis from position: 15
Branch analysis from position: 6
filename:       /in/lDXkh
function name:  (null)
number of ops:  16
compiled vars:  !0 = $test, !1 = $arr, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $3      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   14     3        ASSIGN                                                   !1, <array>
   16     4        ASSIGN                                                   !2, 0
          5      > JMP                                                      ->10
   17     6    >   FETCH_DIM_R                                      ~8      !1, !2
          7        CONCAT                                           ~9      ~8, '%0A'
          8        ECHO                                                     ~9
   16     9        PRE_INC                                                  !2
         10    >   INIT_METHOD_CALL                                         !0, 'count'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0  $11     
         13        IS_SMALLER                                               !2, $11
         14      > JMPNZ                                                    ~12, ->6
   18    15    > > RETURN                                                   1

Class Test:
Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lDXkh
function name:  count
number of ops:  5
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        ECHO                                                     'I+am+called+each+time.%0A'
    8     2        COUNT                                            ~1      !0
          3      > RETURN                                                   ~1
    9     4*     > RETURN                                                   null

End of function count

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.11 ms | 1394 KiB | 13 Q