Help for this page

Select Code to Download


  1. or download this
    846 = 8*(10**2) + 4*(10**1) + 6*(10**0)
    
  2. or download this
    units:    ( int($num / (10**0)) ) % 10
    tens:     ( int($num / (10**1)) ) % 10
    hundreds: ( int($num / (10**2)) ) % 10
    
  3. or download this
    23 = 1*(2**4) + 0*(2**3) + 1*(2**2) + 1*(2**1) + 1*(2**0)
    
  4. or download this
    bit 0: ( int($num / (2**0)) ) % 2
    bit 1: ( int($num / (2**1)) ) % 2
    bit 2: ( int($num / (2**2)) ) % 2
    ...
    bit 7: ( int($num / (2**3)) ) % 2
    
  5. or download this
    int($i / (2**$j))
    
  6. or download this
    $i >> $j
    
  7. or download this
    $k % 2
    
  8. or download this
    $k & 1
    
  9. or download this
    bit 0: ( $num >> 0 ) & 1
    bit 1: ( $num >> 1 ) & 1
    bit 2: ( $num >> 2 ) & 1
    ...
    bit 7: ( $num >> 7 ) & 1
    
  10. or download this
    bit 0: ( $num & (1 << 0) ) >> 0  =  ( $num & (1 << 0) ) ? '1' : '0'
    bit 1: ( $num & (1 << 1) ) >> 1  =  ( $num & (1 << 1) ) ? '1' : '0'
    bit 2: ( $num & (1 << 2) ) >> 2  =  ( $num & (1 << 2) ) ? '1' : '0'
    ...
    bit 7: ( $num & (1 << 7) ) >> 7  =  ( $num & (1 << 7) ) ? '1' : '0'