$p = 0x24; //100100
$d = array(
'Antony and Cleopatra',
'Julius Caesar',
'The Tempest',
'Hamlet',
'Othello',
'Macbeth'
);
$c = count($d) - 1;
$result = array();
foreach ($d as $k => $v) {
if ($p & (1 << ($c - $k))) {
$result[] = $v;
}
}
var_dump($result);