3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getNumbers($count) { $numbers = range(1, $count); shuffle($numbers); return $numbers; } function sumOfRemainders($numbers) { $sum = 0; if (1 === count($numbers)) { return 0; } foreach ($numbers as $a) foreach ($numbers as $b) $sum += $a % $b; return $sum; } print sumOfRemainders( getNumbers(5000) );

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r0fEk
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'sumofremainders'
          1        INIT_FCALL                                               'getnumbers'
          2        SEND_VAL                                                 5000
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_FCALL                                      0  $1      
          6        ECHO                                                     $1
          7      > RETURN                                                   1

Function getnumbers:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r0fEk
function name:  getNumbers
number of ops:  11
compiled vars:  !0 = $count, !1 = $numbers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
    5     6        INIT_FCALL                                               'shuffle'
          7        SEND_REF                                                 !1
          8        DO_ICALL                                                 
    6     9      > RETURN                                                   !1
    7    10*     > RETURN                                                   null

End of function getnumbers

Function sumofremainders:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 13
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/r0fEk
function name:  sumOfRemainders
number of ops:  18
compiled vars:  !0 = $numbers, !1 = $sum, !2 = $a, !3 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        ASSIGN                                                   !1, 0
   12     2        COUNT                                            ~5      !0
          3        IS_IDENTICAL                                             ~5, 1
          4      > JMPZ                                                     ~6, ->6
   13     5    > > RETURN                                                   0
   16     6    > > FE_RESET_R                                       $7      !0, ->15
          7    > > FE_FETCH_R                                               $7, !2, ->15
   17     8    > > FE_RESET_R                                       $8      !0, ->13
          9    > > FE_FETCH_R                                               $8, !3, ->13
   18    10    >   MOD                                              ~9      !2, !3
         11        ASSIGN_OP                                     1          !1, ~9
   17    12      > JMP                                                      ->9
         13    >   FE_FREE                                                  $8
   16    14      > JMP                                                      ->7
         15    >   FE_FREE                                                  $7
   20    16      > RETURN                                                   !1
   21    17*     > RETURN                                                   null

End of function sumofremainders

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.19 ms | 1078 KiB | 17 Q