Logo

Programming-Idioms

  • PHP

Idiom #251 Parse binary digits

Extract integer value i from its binary string representation s (in radix 2)
E.g. "1101" -> 13

$i = bindec($s);
(def i (read-string (str "2r" s)))

New implementation...