Yngvarr

Generation

generate functionTue, 14 Feb 2023

01 to 1

function bin2dec($str) { $str_ary = str_split($str); $result = 0; foreach ($str_ary as $key => $value) { $result += $value * pow(2, (count($str_ary) - 1 - $key)); } return $result; } echo(bin2dec(110101));

Questions about programming?Chat with your personal AI assistant