3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php phpversion >= "7.0.0" or die(); $a = 5; $n = 2; echo $a % $n,"\n"; //echo mod($a,$n),"\n"; PHP doesn't have mod() but does have fmod(); see http://php.net/fmod echo fmod((float)$a,(float)$n),"\n"; echo $a - ($n * (int)($a/$n)),"\n"; $a = INF; $n = pow(2.,64.); try{ echo $a % $n,"\n"; } catch (Error $e){ echo $e->getMessage(),"\n"; } echo fmod((float)$a,(float)$n),"\n"; echo $a - ($n * (int)($a/$n)),"\n";
based on T8DWQ
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 34
Branch analysis from position: 34
2 jumps found. (Code = 107) Position 1 = 35, Position 2 = -2
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7sErV
function name:  (null)
number of ops:  54
compiled vars:  !0 = $a, !1 = $n, !2 = $e
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   FETCH_CONSTANT                                   ~3      'phpversion'
         1        IS_SMALLER_OR_EQUAL                              ~4      '7.0.0', ~3
         2      > JMPNZ_EX                                         ~4      ~4, ->5
         3    > > EXIT                                                     
         4*       BOOL                                             ~4      <true>
   3     5    >   ASSIGN                                                   !0, 5
   4     6        ASSIGN                                                   !1, 2
   6     7        MOD                                              ~7      !0, !1
         8        ECHO                                                     ~7
         9        ECHO                                                     '%0A'
   8    10        INIT_FCALL                                               'fmod'
        11        CAST                                          5  ~8      !0
        12        SEND_VAL                                                 ~8
        13        CAST                                          5  ~9      !1
        14        SEND_VAL                                                 ~9
        15        DO_ICALL                                         $10     
        16        ECHO                                                     $10
        17        ECHO                                                     '%0A'
   9    18        DIV                                              ~11     !0, !1
        19        CAST                                          4  ~12     ~11
        20        MUL                                              ~13     !1, ~12
        21        SUB                                              ~14     !0, ~13
        22        ECHO                                                     ~14
        23        ECHO                                                     '%0A'
  12    24        ASSIGN                                                   !0, INF
  13    25        INIT_FCALL                                               'pow'
        26        SEND_VAL                                                 2
        27        SEND_VAL                                                 64
        28        DO_ICALL                                         $16     
        29        ASSIGN                                                   !1, $16
  15    30        MOD                                              ~18     !0, !1
        31        ECHO                                                     ~18
        32        ECHO                                                     '%0A'
        33      > JMP                                                      ->39
  16    34  E > > CATCH                                                    'Error', !2
  17    35    >   INIT_METHOD_CALL                                         !2, 'getMessage'
        36        DO_FCALL                                      0  $19     
        37        ECHO                                                     $19
        38        ECHO                                                     '%0A'
  19    39    >   INIT_FCALL                                               'fmod'
        40        CAST                                          5  ~20     !0
        41        SEND_VAL                                                 ~20
        42        CAST                                          5  ~21     !1
        43        SEND_VAL                                                 ~21
        44        DO_ICALL                                         $22     
        45        ECHO                                                     $22
        46        ECHO                                                     '%0A'
  20    47        DIV                                              ~23     !0, !1
        48        CAST                                          4  ~24     ~23
        49        MUL                                              ~25     !1, ~24
        50        SUB                                              ~26     !0, ~25
        51        ECHO                                                     ~26
        52        ECHO                                                     '%0A'
        53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0