- base_convert: documentation ( source)
- intval: documentation ( source)
- printf: documentation ( source)
<?php
$a = 65;
$b = ~$a + 1; // get 2s complement
echo $b,"\n";
printf("0x%x\n\n",$b);
$c = base_convert($b,10,2);
echo $c,"\n";
$i = intval($c,2);
echo $i;