3v4l.org

run code in 300+ PHP versions simultaneously
<?php function roundUpToNearestThousand($n) { return (int) (1000 * ceil($n/1000)); } var_dump( roundUpToNearestThousand(999), roundUpToNearestThousand(1000.001), roundUpToNearestThousand(1001), roundUpToNearestThousand(1100), roundUpToNearestThousand(1600), roundUpToNearestThousand(100010) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SX82Y
function name:  (null)
number of ops:  27
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'var_dump'
    9     1        INIT_FCALL                                               'rounduptonearestthousand'
          2        SEND_VAL                                                 999
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
   10     5        INIT_FCALL                                               'rounduptonearestthousand'
          6        SEND_VAL                                                 1000
          7        DO_FCALL                                      0  $1      
          8        SEND_VAR                                                 $1
   11     9        INIT_FCALL                                               'rounduptonearestthousand'
         10        SEND_VAL                                                 1001
         11        DO_FCALL                                      0  $2      
         12        SEND_VAR                                                 $2
   12    13        INIT_FCALL                                               'rounduptonearestthousand'
         14        SEND_VAL                                                 1100
         15        DO_FCALL                                      0  $3      
         16        SEND_VAR                                                 $3
   13    17        INIT_FCALL                                               'rounduptonearestthousand'
         18        SEND_VAL                                                 1600
         19        DO_FCALL                                      0  $4      
         20        SEND_VAR                                                 $4
   14    21        INIT_FCALL                                               'rounduptonearestthousand'
         22        SEND_VAL                                                 100010
         23        DO_FCALL                                      0  $5      
         24        SEND_VAR                                                 $5
    8    25        DO_ICALL                                                 
   15    26      > RETURN                                                   1

Function rounduptonearestthousand:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SX82Y
function name:  roundUpToNearestThousand
number of ops:  9
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'ceil'
          2        DIV                                              ~1      !0, 1000
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5        MUL                                              ~3      $2, 1000
          6        CAST                                          4  ~4      ~3
          7      > RETURN                                                   ~4
    6     8*     > RETURN                                                   null

End of function rounduptonearestthousand

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.34 ms | 1464 KiB | 21 Q