My code is like this :
Here is in http://php.net/manual/en/function.bindec.php#44910
function reconvert($bin_nr) {
$base=1;
$dec_nr=0;
$bin_nr=explode(",", preg_replace("/(.*),/", "$1", str_replace("1", "1,", str_replace("0", "0,", $bin_nr))));
for($i=1; $i<count($bin_nr); $i++) $base=$base*2;
foreach($bin_nr as $key=>$bin_nr_bit) {
if($bin_nr_bit==1) {
$dec_nr+=$base;
$base=$base/2;
}
if($bin_nr_bit==0) $base=$base/2;
}
return(array("string"=>chr($dec_nr), "int"=>$dec_nr));
}
Check here : https://eval.in/556903