3v4l.org

run code in 500+ PHP versions simultaneously
<?php $total = 100; $pieces = 3; $precision = 2; $parts = array_fill(0, $pieces - 1, round($total / $pieces, $precision)); $parts[] = $total - array_sum($parts); print_r($parts);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GbGHK
function name:  (null)
number of ops:  25
compiled vars:  !0 = $total, !1 = $pieces, !2 = $precision, !3 = $parts
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 100
    4     1        ASSIGN                                                       !1, 3
    5     2        ASSIGN                                                       !2, 2
    6     3        INIT_FCALL                                                   'array_fill'
          4        SEND_VAL                                                     0
          5        SUB                                                  ~7      !1, 1
          6        SEND_VAL                                                     ~7
          7        INIT_FCALL                                                   'round'
          8        DIV                                                  ~8      !0, !1
          9        SEND_VAL                                                     ~8
         10        SEND_VAR                                                     !2
         11        DO_ICALL                                             $9      
         12        SEND_VAR                                                     $9
         13        DO_ICALL                                             $10     
         14        ASSIGN                                                       !3, $10
    7    15        INIT_FCALL                                                   'array_sum'
         16        SEND_VAR                                                     !3
         17        DO_ICALL                                             $13     
         18        SUB                                                  ~14     !0, $13
         19        ASSIGN_DIM                                                   !3
         20        OP_DATA                                                      ~14
    8    21        INIT_FCALL                                                   'print_r'
         22        SEND_VAR                                                     !3
         23        DO_ICALL                                                     
         24      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.7 ms | 2076 KiB | 17 Q