in reply to Counter Intuitive Code
Just wrap $x in int()?
$or |= $x ; #change to => $or |= int($x); [download]