function get_permission2($perm){
$perm_num = ord($perm);
$result = array(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE);
if (1&$perm_num) $result[0]=TRUE;
if (2&$perm_num) $result[1]=TRUE;
if (4&$perm_num) $result[2]=TRUE;
if (8&$perm_num) $result[3]=TRUE;
if (16&$perm_num) $result[4]=TRUE;
if (32&$perm_num) $result[5]=TRUE;
if (64&$perm_num) $result[6]=TRUE;
if (128&$perm_num) $result[7]=TRUE;
return($result); }
运行20000次,大约:0.746-0.761s
function get_permission2($perm){
$perm_num = ord($perm); // $result = array(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE);
if (1&$perm_num) $result[]=TRUE; else $result[]=FALSE;
if (2&$perm_num) $result[]=TRUE; else $result[]=FALSE;
if (4&$perm_num) $result[]=TRUE; else $result[]=FALSE;
if (8&$perm_num) $result[]=TRUE; else $result[]=FALSE;
if (16&$perm_num) $result[]=TRUE; else $result[]=FALSE;
if (32&$perm_num) $result[]=TRUE; else $result[]=FALSE;
if (64&$perm_num) $result[]=TRUE; else $result[]=FALSE;
if (128&$perm_num) $result[]=TRUE; else $result[]=FALSE;