3v4l.org

run code in 300+ PHP versions simultaneously
<?php ob_start(); var_dump(intdiv(3, 2)); var_dump(intdiv(-3, 2)); var_dump(intdiv(3, -2)); var_dump(intdiv(-3, -2)); var_dump(intdiv(PHP_INT_MAX, PHP_INT_MAX)); var_dump(intdiv(~PHP_INT_MAX, ~PHP_INT_MAX)); try { var_dump(intdiv(~PHP_INT_MAX, -1)); } catch (Throwable $e) { echo "Exception: " . $e->getMessage() . "\n"; } try { var_dump(intdiv(1, 0)); } catch (Throwable $e) { echo "Exception: " . $e->getMessage() . "\n"; } $result = ob_get_contents(); ob_end_clean(); $expectedOutput = <<<EOT int(1) int(-1) int(-1) int(1) int(1) int(1) Exception: Division of PHP_INT_MIN by -1 is not an integer Exception: Division by zero EOT; var_dump($expectedOutput); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 52
Branch analysis from position: 52
2 jumps found. (Code = 107) Position 1 = 53, Position 2 = -2
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
Found catch point at position: 66
Branch analysis from position: 66
2 jumps found. (Code = 107) Position 1 = 67, Position 2 = -2
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cDHDl
function name:  (null)
number of ops:  85
compiled vars:  !0 = $e, !1 = $result, !2 = $expectedOutput
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'ob_start'
          1        DO_ICALL                                                 
    5     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'intdiv'
          4        SEND_VAL                                                 3
          5        SEND_VAL                                                 2
          6        DO_ICALL                                         $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
    6     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'intdiv'
         11        SEND_VAL                                                 -3
         12        SEND_VAL                                                 2
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
    7    16        INIT_FCALL                                               'var_dump'
         17        INIT_FCALL                                               'intdiv'
         18        SEND_VAL                                                 3
         19        SEND_VAL                                                 -2
         20        DO_ICALL                                         $8      
         21        SEND_VAR                                                 $8
         22        DO_ICALL                                                 
    8    23        INIT_FCALL                                               'var_dump'
         24        INIT_FCALL                                               'intdiv'
         25        SEND_VAL                                                 -3
         26        SEND_VAL                                                 -2
         27        DO_ICALL                                         $10     
         28        SEND_VAR                                                 $10
         29        DO_ICALL                                                 
    9    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'intdiv'
         32        SEND_VAL                                                 9223372036854775807
         33        SEND_VAL                                                 9223372036854775807
         34        DO_ICALL                                         $12     
         35        SEND_VAR                                                 $12
         36        DO_ICALL                                                 
   10    37        INIT_FCALL                                               'var_dump'
         38        INIT_FCALL                                               'intdiv'
         39        SEND_VAL                                                 -9223372036854775808
         40        SEND_VAL                                                 -9223372036854775808
         41        DO_ICALL                                         $14     
         42        SEND_VAR                                                 $14
         43        DO_ICALL                                                 
   12    44        INIT_FCALL                                               'var_dump'
         45        INIT_FCALL                                               'intdiv'
         46        SEND_VAL                                                 -9223372036854775808
         47        SEND_VAL                                                 -1
         48        DO_ICALL                                         $16     
         49        SEND_VAR                                                 $16
         50        DO_ICALL                                                 
         51      > JMP                                                      ->58
   13    52  E > > CATCH                                       last         'Throwable'
   14    53    >   INIT_METHOD_CALL                                         !0, 'getMessage'
         54        DO_FCALL                                      0  $18     
         55        CONCAT                                           ~19     'Exception%3A+', $18
         56        CONCAT                                           ~20     ~19, '%0A'
         57        ECHO                                                     ~20
   17    58    >   INIT_FCALL                                               'var_dump'
         59        INIT_FCALL                                               'intdiv'
         60        SEND_VAL                                                 1
         61        SEND_VAL                                                 0
         62        DO_ICALL                                         $21     
         63        SEND_VAR                                                 $21
         64        DO_ICALL                                                 
         65      > JMP                                                      ->72
   18    66  E > > CATCH                                       last         'Throwable'
   19    67    >   INIT_METHOD_CALL                                         !0, 'getMessage'
         68        DO_FCALL                                      0  $23     
         69        CONCAT                                           ~24     'Exception%3A+', $23
         70        CONCAT                                           ~25     ~24, '%0A'
         71        ECHO                                                     ~25
   22    72    >   INIT_FCALL                                               'ob_get_contents'
         73        DO_ICALL                                         $26     
         74        ASSIGN                                                   !1, $26
   23    75        INIT_FCALL                                               'ob_end_clean'
         76        DO_ICALL                                                 
   25    77        ASSIGN                                                   !2, 'int%281%29%0Aint%28-1%29%0Aint%28-1%29%0Aint%281%29%0Aint%281%29%0Aint%281%29%0AException%3A+Division+of+PHP_INT_MIN+by+-1+is+not+an+integer%0AException%3A+Division+by+zero'
   36    78        INIT_FCALL                                               'var_dump'
         79        SEND_VAR                                                 !2
         80        DO_ICALL                                                 
   37    81        INIT_FCALL                                               'var_dump'
         82        SEND_VAR                                                 !1
         83        DO_ICALL                                                 
         84      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.29 ms | 1396 KiB | 23 Q