3v4l.org

run code in 300+ PHP versions simultaneously
<?php $in = range(0, 1000); $out = []; $f = 100; foreach ($in as $i) { $out[] = do2($f, $i); } print_r($out); function inc($v) { $step = pow(10, floor(log10($v / 50))) ; return $v + $step; } function do2($v, $steps) { $result = $v; while ($steps--) { $result = inc($result); } return $result; }

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/nUEmg
function name:  (null)
number of ops:  21
compiled vars:  !0 = $in, !1 = $out, !2 = $f, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 1000
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
    5     5        ASSIGN                                                   !1, <array>
    7     6        ASSIGN                                                   !2, 100
    8     7      > FE_RESET_R                                       $8      !0, ->16
          8    > > FE_FETCH_R                                               $8, !3, ->16
    9     9    >   INIT_FCALL_BY_NAME                                       'do2'
         10        SEND_VAR_EX                                              !2
         11        SEND_VAR_EX                                              !3
         12        DO_FCALL                                      0  $10     
         13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  $10
    8    15      > JMP                                                      ->8
         16    >   FE_FREE                                                  $8
   12    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
   29    20      > RETURN                                                   1

Function inc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nUEmg
function name:  inc
number of ops:  16
compiled vars:  !0 = $v, !1 = $step
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'pow'
          2        SEND_VAL                                                 10
          3        INIT_FCALL                                               'floor'
          4        INIT_FCALL                                               'log10'
          5        DIV                                              ~2      !0, 50
          6        SEND_VAL                                                 ~2
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                         $5      
         12        ASSIGN                                                   !1, $5
   17    13        ADD                                              ~7      !0, !1
         14      > RETURN                                                   ~7
   18    15*     > RETURN                                                   null

End of function inc

Function do2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
Branch analysis from position: 4
filename:       /in/nUEmg
function name:  do2
number of ops:  12
compiled vars:  !0 = $v, !1 = $steps, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     2        ASSIGN                                                   !2, !0
   24     3      > JMP                                                      ->8
   25     4    >   INIT_FCALL                                               'inc'
          5        SEND_VAR                                                 !2
          6        DO_FCALL                                      0  $4      
          7        ASSIGN                                                   !2, $4
   24     8    >   POST_DEC                                         ~6      !1
          9      > JMPNZ                                                    ~6, ->4
   28    10    > > RETURN                                                   !2
   29    11*     > RETURN                                                   null

End of function do2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.12 ms | 1022 KiB | 19 Q