Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,884 questions

51,810 answers

573 users

How to convert binary code to text in PHP

1 Answer

0 votes
function bin2text($bin_txt) {  
    $text = ''; 
    $chars = explode("\n", chunk_split(str_replace("\n", '', $bin_txt), 8)); 
    array_pop($chars);
    $len = count($chars);
      
    for ($i = 0; $i < $len; $text .= chr(bindec($chars[$i])), $i++); 
      
    return $text; 
} 
  
echo bin2text("010100000100100001010000001000000101000001110010011011110110011101110010011000010110110101101101011010010110111001100111");

               
               
/*
 
run:
 
PHP Programming
 
*/


answered Aug 27, 2014 by avibootz
edited Apr 14, 2025 by avibootz

Related questions

1 answer 70 views
2 answers 90 views
1 answer 463 views
463 views asked Aug 26, 2014 by avibootz
1 answer 76 views
1 answer 69 views
...