3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = "天在变 我心 融化 谁能懂 恨 与谁共"; function asc2bin($temp) { $len = strlen($temp); for($i=0; $i<$len; $i++) { $data .= sprintf("%08b", ord(substr($temp, $i, 1))); } return $data; } echo asc2bin($str);
Output for 5.0.4 - 7.1.0
Notice: Undefined variable: data in /in/Ao5bi on line 12 1110010110100100101010011110010110011100101010001110010110001111100110000000101011100110100010001001000111100101101111111000001100001010111010001001111010001101111001011000110010010110000010101110100010110000100000011110100010000011101111011110011010000111100000100000101011100110100000011010100000001010111001001011100010001110111010001011000010000001111001011000010110110001
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: data in /in/Ao5bi on line 12 1110010110100100101010011110010110011100101010001110010110001111100110000000101011100110100010001001000111100101101111111000001100001010111010001001111010001101111001011000110010010110000010101110100010110000100000011110100010000011101111011110011010000111100000100000101011100110100000011010100000001010111001001011100010001110111010001011000010000001111001011000010110110001