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 $b->b($a);
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
呇㥹婗で慘䉺摗で婇㥳戳䥧挲氰䥇䙴婘关䥇乶扮乬夳剬摈噹䥇䙫慘䉰挲汪慗㕮䥇噳慘关䥈乬婃䉫批䉬慘噺扗㥫䥈剬托䉶捩䉰扭买婇汫摗㔰䥈嘰䥇硨奭㥹婓䉬摃䉫戲硶捭啧扗䙮扭䕧套硰捘器䱩䉖摃䉬扭汴䥇䙫䥇ㅰ扭汴䥈婬扭汨打睧捘噰捹䉵戳丰据噫䥇嘴婘䩪慘剨摇汶扩䈱扇硨扗乶䥇硨奭㥹慘䵧扭決慓䈱摃䉨扇汸摗汷䥇嘴䥇器䥇乶扗ㅶ婇㡧夲㥵挲噸摗䘰䱩䉅摗決䥇䘱摇啧慘䨱捭啧婇㥳戳䥧慗㑧捭噷捭噯婗㕫婘䩰摃䉰扩䈲戲砱捈剨摇啧摭噳慘內婘乺婓䉪慗硳摗で婇㥳戳䩬䥇嘱䥇娱娲汨摃䉵摗硳奓䉷奘䩰奘刱捩㑧剘桪婘䈰婘噹䥈买扮內戲乪套噪奘內夳噷慗剨摇䘰䥇㕶扩䉷捭㥰婇噵摃睧挳噵摃䉰扩䉪摗硷奓䉸摗歧戲婭慗买奓䉫婘乬据噵摃䉴戲硳慘內套㕰打䉰婃䉬挳內扇䙩戳䨱打㑧呮噳扇䕧捇桨捭嘰捭䕳䥈乨捇汬扩䉬摃䉬扇噴婗㔰摗で摗砰捭汪慗噺䱃䈰婗硳摘䵧套㔰婓䉭婘噮慗䘰䥇䙹夳啳䥇噮婘內摇噴捈噺䥇ㅨ挳乨䥇ㅨ娲㕨䥇汫䥇噹奘兵䥆䉹套噺婗㔰䥇婨摗买奮噺䥈剶据剶捩䉨摃䉬挳內捇桨捭嘰捭䕧夳噹挳噺䱩䉆摇汨打䉬扇噰婭噵婃䉫摗歧摭噳䥇剶扇㥹䥇硶奭㥹摇決䱃䈱摃䉴奘到慘䵧摇㥹摇㥹䥇乶扗ㅶ婇㡵䥅乹奘䵧捭桶扭丱捹䉸摗決䥇㥹夲歧捘噰捹䉪戲㕮摗啵䥆䉹套噺婗㔰䥇硶奭㥹摇決䥇硬夳刱捹䉬摃䉨扇汸摗嘰䥈噳摈䩰夲噺䱩䉑婗硳婗㔰婘乸摗啧摈䩰挳剰捘噬䥈䘱套で扗䙮扭䕳䥇䙪䥇桬扭剹婘䩰摃䉷摘䨱捹䉴套硬挳器婇䕧扇䙶捭噬摃㑧唳噺捇噵婇決挲啧扭噸摗啧婘䩨摃睧夲㥴扗㥫批䉺摘乪慘䉰摃䉳慗䩬捭㡧婘啳䥈噳摈䩰夲汬捹䉮捭䘲慗剨䥇噵慗ふ䥆乬婃䉳摗丰摘䵧扇噪摈噺䥈䘱慘䵧婇汮扭決挲汴䥇汴捇噹婇汬摃㑧唲噫䥇䙵摇啧挲䙷慗噵䱃䉩慗䩬扭刱打䉬摃䉷婗硳婗㔰婘乸摗啧婘啳䥈䉹婘剰摗で摭㥳摘剷奘內扗䙮扭䕵䥅嘰慗䙴䥇婨摗买奮噺䱃䉴慓䈲慘剨婓䉳戲䩶据剰捹䉰托䉬捭剰婘关䥇噹奘內婗硰摃䉺戲剨扇噺䥇䙵摇啳䥇䘰䥇乶扭剰扗噵摈噴䥇㔱扇硨䥈噹扭䕧套䵧扮噳扇䕵
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/7Pg8B 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/7Pg8B 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/7Pg8B on line 4
Process exited with code 255.