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

Semrush - keyword research tool

Create your online store today with Shopify

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth

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

Disclosure: My content contains affiliate links.

43,569 questions

56,787 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 174 views
2 answers 213 views
1 answer 576 views
576 views asked Aug 26, 2014 by avibootz
1 answer 178 views
1 answer 164 views
...