3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { public function b($c) { static $d = array(); if (empty($d)) { for ($i = 0; $i < 256; $i++) { $d[chr($i)] = $i; } } $e = strlen($c); $f = ''; if ($e % 2 !== 0) { $c .= ' '; } $g = $e >> 4 << 4; for ($i = 0; $i < $g; $i++) { $f .= pack('n8', ($d[$c[$i]] << 8) + $d[$c[++$i]], ($d[$c[++$i]] << 8) + $d[$c[++$i]], ($d[$c[++$i]] << 8) + $d[$c[++$i]], ($d[$c[++$i]] << 8) + $d[$c[++$i]], ($d[$c[++$i]] << 8) + $d[$c[++$i]], ($d[$c[++$i]] << 8) + $d[$c[++$i]], ($d[$c[++$i]] << 8) + $d[$c[++$i]], ($d[$c[++$i]] << 8) + $d[$c[++$i]] ); } for ($i; $i < $e; $i++) { $f .= pack('n', ($d[$c[$i]] << 8) + $d[$c[++$i]]); } return mb_convert_encoding($f, 'UTF-8', 'UCS-2BE'); } } $a = base64_encode("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nulla pharetra, sapien et elementum ultricies, tellus ante feugiat arcu, eget tempus massa magna id erat. Praesent faucibus tortor at est pharetra cursus. Etiam eleifend dui vel dolor lobortis, ut mattis tortor commodo. Cras rhoncus quis orci quis congue. Praesent lobortis lectus et aliquet ultrices. Pellentesque tristique quam magna, ac hendrerit purus malesuada laoreet. Suspendisse neque erat, commodo suscipit libero eu, ultricies gravida enim. Sed luctus lectus quis dignissim imperdiet. Sed ante sapien, bibendum et pellentesque eu, pretium volutpat magna. Etiam faucibus, mi vitae lobortis imperdiet, erat elit sodales ante, at condimentum nulla urna ac nulla."); $b = new A(); echo $a->b($b);
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to a member function b() on string in /in/l3TcY:38 Stack trace: #0 {main} thrown in /in/l3TcY on line 38
Process exited with code 255.
Output for hhvm-3.10.0 - 3.13.2
Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function b() on a non-object (string)' in /in/l3TcY:38 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.28
Fatal error: Call to a member function b() on string in /in/l3TcY on line 38
Process exited with code 255.
Output for 5.0.0 - 5.5.38
Fatal error: Call to a member function b() on a non-object in /in/l3TcY on line 38
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/l3TcY on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/l3TcY on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/l3TcY on line 4
Process exited with code 255.