I have a binary number 11000 i need to flip the number to get the answer 00111 and i need the result in PHP, i did it using the for loop but how can i do it using bitwise operator i think we can do it using ^ operator here is the PHP solution:
function getIntegerComplement($n) {
    // $n is a decimal number
    $binary = decbin($n);
    $arr = str_split($binary);  
    $complement = "";
    foreach($arr as $i)
      $complement .= ($i == 0) ? (1) : (0);
}
any help would be appriciated
 
     
     
    