I've been trying to get a code together that would deduce what alternatives have been check in a multi-choice exam, but using sums of powers of two.
I found the following code online, but I'm not sure HOW it works, especially the operator <<. I could not find this on Google or PHPDoc.
Thank you.
$aSums = array();
for ($iCount = 0; $iCount < 32; $iCount++)
{
$iMask = 1 << $iCount;
if (($iNumber & $iMask) != 0)
$aSums[] = $iMask;
}
return $aSums;