3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "int cast: ",-( (int)((2 ** 32) - 0xffffffff)); // -1 echo "int cast: ", (int)(0xffffffff - (2 ** 32)); // -1 printf("\nprintf: %d\n", -((int) (2 ** 32) - 0xffffffff)); // treat as a signed number -- first gets cast to an int? echo "hexdec: "; var_dump((int) hexdec("ffffffff")); printf("\nprintf max int in hex: %x\n",PHP_INT_MAX); echo 0x5,"\n"; echo ~0x5 + 1,"\n"; // transform to -5 $n = sprintf("0x%x", (pow(2,32) - 5) ); // get 2s complement var_dump($n); $i = intval($n + 0); // trick that doesn't work anymore with PHP 7 echo $i; var_dump($i); printf("%x",$i); // display binary as hex $r = 0xffffffff & 0xfffffffb; // anding to simplify var_dump($r); echo 0xfb - pow(2,8); // to detect value of hex printf("\n%x\n",(pow(2, 32) - 5)); echo (5 + 0xfffffffb) == pow(2,32)? 'true':'false'; // floats both echo "\n",0xfffffffb > 0x7fffffff? 'true':'false';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 79, Position 2 = 81
Branch analysis from position: 79
1 jumps found. (Code = 42) Position 1 = 82
Branch analysis from position: 82
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 87
Branch analysis from position: 85
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 87
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 81
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 87
Branch analysis from position: 85
Branch analysis from position: 87
filename:       /in/EkfSn
function name:  (null)
number of ops:  90
compiled vars:  !0 = $n, !1 = $i, !2 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     'int+cast%3A+'
          1        CAST                                          4  ~3      1
          2        MUL                                              ~4      ~3, -1
          3        ECHO                                                     ~4
    4     4        ECHO                                                     'int+cast%3A+'
          5        CAST                                          4  ~5      -1
          6        ECHO                                                     ~5
    6     7        INIT_FCALL                                               'printf'
          8        SEND_VAL                                                 '%0Aprintf%3A+%25d%0A'
          9        CAST                                          4  ~6      4294967296
         10        SUB                                              ~7      ~6, 4294967295
         11        MUL                                              ~8      ~7, -1
         12        SEND_VAL                                                 ~8
         13        DO_ICALL                                                 
    7    14        ECHO                                                     'hexdec%3A+'
    8    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'hexdec'
         17        SEND_VAL                                                 'ffffffff'
         18        DO_ICALL                                         $10     
         19        CAST                                          4  ~11     $10
         20        SEND_VAL                                                 ~11
         21        DO_ICALL                                                 
    9    22        INIT_FCALL                                               'printf'
         23        SEND_VAL                                                 '%0Aprintf+max+int+in+hex%3A+%25x%0A'
         24        SEND_VAL                                                 9223372036854775807
         25        DO_ICALL                                                 
   11    26        ECHO                                                     5
         27        ECHO                                                     '%0A'
   12    28        ECHO                                                     -5
         29        ECHO                                                     '%0A'
   13    30        INIT_FCALL                                               'sprintf'
         31        SEND_VAL                                                 '0x%25x'
         32        INIT_FCALL                                               'pow'
         33        SEND_VAL                                                 2
         34        SEND_VAL                                                 32
         35        DO_ICALL                                         $14     
         36        SUB                                              ~15     $14, 5
         37        SEND_VAL                                                 ~15
         38        DO_ICALL                                         $16     
         39        ASSIGN                                                   !0, $16
   14    40        INIT_FCALL                                               'var_dump'
         41        SEND_VAR                                                 !0
         42        DO_ICALL                                                 
   15    43        ADD                                              ~19     !0, 0
         44        CAST                                          4  ~20     ~19
         45        ASSIGN                                                   !1, ~20
   16    46        ECHO                                                     !1
   17    47        INIT_FCALL                                               'var_dump'
         48        SEND_VAR                                                 !1
         49        DO_ICALL                                                 
   18    50        INIT_FCALL                                               'printf'
         51        SEND_VAL                                                 '%25x'
         52        SEND_VAR                                                 !1
         53        DO_ICALL                                                 
   19    54        ASSIGN                                                   !2, 4294967291
   20    55        INIT_FCALL                                               'var_dump'
         56        SEND_VAR                                                 !2
         57        DO_ICALL                                                 
   21    58        INIT_FCALL                                               'pow'
         59        SEND_VAL                                                 2
         60        SEND_VAL                                                 8
         61        DO_ICALL                                         $26     
         62        SUB                                              ~27     251, $26
         63        ECHO                                                     ~27
   22    64        INIT_FCALL                                               'printf'
         65        SEND_VAL                                                 '%0A%25x%0A'
         66        INIT_FCALL                                               'pow'
         67        SEND_VAL                                                 2
         68        SEND_VAL                                                 32
         69        DO_ICALL                                         $28     
         70        SUB                                              ~29     $28, 5
         71        SEND_VAL                                                 ~29
         72        DO_ICALL                                                 
   23    73        INIT_FCALL                                               'pow'
         74        SEND_VAL                                                 2
         75        SEND_VAL                                                 32
         76        DO_ICALL                                         $31     
         77        IS_EQUAL                                                 $31, 4294967296
         78      > JMPZ                                                     ~32, ->81
         79    >   QM_ASSIGN                                        ~33     'true'
         80      > JMP                                                      ->82
         81    >   QM_ASSIGN                                        ~33     'false'
         82    >   ECHO                                                     ~33
   24    83        ECHO                                                     '%0A'
         84      > JMPZ                                                     <true>, ->87
         85    >   QM_ASSIGN                                        ~34     'true'
         86      > JMP                                                      ->88
         87    >   QM_ASSIGN                                        ~34     'false'
         88    >   ECHO                                                     ~34
         89      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.49 ms | 1011 KiB | 18 Q