3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Shipping { /** * @return integer The minimum number of boxes needed to hold a given number of items */ public static function minimalNumberOfPackages($items, $availableLargePackages, $availableSmallPackages) { $maxSize = $availableLargePackages * 5; $minSize = $availableSmallPackages * 1; if ($items > $maxSize + $minSize) return -1; var_dump($items % $availableLargePackages, $items / $availableLargePackages); return NULL; } } echo Shipping::minimalNumberOfPackages(10, 30, 10);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BJa2h
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   INIT_STATIC_METHOD_CALL                                      'Shipping', 'minimalNumberOfPackages'
          1        SEND_VAL                                                     10
          2        SEND_VAL                                                     30
          3        SEND_VAL                                                     10
          4        DO_FCALL                                          0  $0      
          5        ECHO                                                         $0
          6      > RETURN                                                       1

Class Shipping:
Function minimalnumberofpackages:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BJa2h
function name:  minimalNumberOfPackages
number of ops:  19
compiled vars:  !0 = $items, !1 = $availableLargePackages, !2 = $availableSmallPackages, !3 = $maxSize, !4 = $minSize
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
   10     3        MUL                                                  ~5      !1, 5
          4        ASSIGN                                                       !3, ~5
   11     5        MUL                                                  ~7      !2, 1
          6        ASSIGN                                                       !4, ~7
   13     7        ADD                                                  ~9      !3, !4
          8        IS_SMALLER                                                   ~9, !0
          9      > JMPZ                                                         ~10, ->11
         10    > > RETURN                                                       -1
   15    11    >   INIT_FCALL                                                   'var_dump'
         12        MOD                                                  ~11     !0, !1
         13        SEND_VAL                                                     ~11
         14        DIV                                                  ~12     !0, !1
         15        SEND_VAL                                                     ~12
         16        DO_ICALL                                                     
   16    17      > RETURN                                                       null
   17    18*     > RETURN                                                       null

End of function minimalnumberofpackages

End of class Shipping.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
228.59 ms | 2035 KiB | 14 Q