3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $_content = '&#1575;&#1587;&#1605;&#32;&#1588;&#1575;&#1577;&#32;&#1593;&#1605;&#1585;&#32;&#51;&#51;&#32;&#1606;&#1576;&#32;&#32;&#1606;&#1593;&#1605;&#1604;&#32;&#1585;&#1605;&#32;&#1593;&#1606;&#32;&#1606;&#1608;&#1575;&#1585;&#32;&#1601;&#32;&#1608;&#1607;'; function unescape($str) { $str = rawurldecode($str); preg_match_all("/(?:%u.{4})|&#x.{4};|&#\d+;|.+/U",$str,$r); $ar = $r[0]; print_r($ar); foreach($ar as $k=>$v) { if(substr($v,0,2) == "%u") $ar[$k] = iconv("UCS-2","UTF-8",pack("H4",substr($v,-4))); elseif(substr($v,0,3) == "&#x") $ar[$k] = iconv("UCS-2","UTF-8",pack("H4",substr($v,3,-1))); elseif(substr($v,0,2) == "&#") { echo substr($v,2,-1)."<br>"; $ar[$k] = iconv("UCS-2","UTF-8",pack("n",substr($v,2,-1))); } } return join("",$ar); } echo unescape($_content);
based on TtQGv
Output for 5.3.18 - 5.5.34, 5.6.8 - 5.6.20, 5.6.28 - 7.0.5, 7.0.20 - 7.2.0
Array ( [0] => &#1575; [1] => &#1587; [2] => &#1605; [3] => &#32; [4] => &#1588; [5] => &#1575; [6] => &#1577; [7] => &#32; [8] => &#1593; [9] => &#1605; [10] => &#1585; [11] => &#32; [12] => &#51; [13] => &#51; [14] => &#32; [15] => &#1606; [16] => &#1576; [17] => &#32; [18] => &#32; [19] => &#1606; [20] => &#1593; [21] => &#1605; [22] => &#1604; [23] => &#32; [24] => &#1585; [25] => &#1605; [26] => &#32; [27] => &#1593; [28] => &#1606; [29] => &#32; [30] => &#1606; [31] => &#1608; [32] => &#1575; [33] => &#1585; [34] => &#32; [35] => &#1601; [36] => &#32; [37] => &#1608; [38] => &#1607; ) 1575<br>1587<br>1605<br>32<br>1588<br>1575<br>1577<br>32<br>1593<br>1605<br>1585<br>32<br>51<br>51<br>32<br>1606<br>1576<br>32<br>32<br>1606<br>1593<br>1605<br>1604<br>32<br>1585<br>1605<br>32<br>1593<br>1606<br>32<br>1606<br>1608<br>1575<br>1585<br>32<br>1601<br>32<br>1608<br>1607<br>✆㌆䔆 㐆✆⤆ 㤆䔆ㄆ ㌀㌀ 䘆⠆  䘆㤆䔆䐆 ㄆ䔆 㤆䘆 䘆䠆✆ㄆ 䄆 䠆䜆
Output for 7.0.6
Array ( [0] => &#1575; [1] => &#1587; [2] => &#1605; [3] => &#32; [4] => &#1588; [5] => &#1575; [6] => &#1577; [7] => &#32; [8] => &#1593; [9] => &#1605; [10] => &#1585; [11] => &#32; [12] => &#51; [13] => &#51; [14] => &#32; [15] => &#1606; [16] => &#1576; [17] => &#32; [18] => &#32; [19] => &#1606; [20] => &#1593; [21] => &#1605; [22] => &#1604; [23] => &#32; [24] => &#1585; [25] => &#1605; [26] => &#32; [27] => &#1593; [28] => &#1606; [29] => &#32; [30] => &#1606; [31] => &#1608; [32] => &#1575; [33] => &#1585; [34] => &#32; [35] => &#1601; [36] => &#32; [37] => &#1608; [38] => &#1607; ) 1575<br> Fatal error: Uncaught Error: Call to undefined function iconv() in /in/F1b6Z:15 Stack trace: #0 /in/F1b6Z(20): unescape('&#1575;&#1587;&...') #1 {main} thrown in /in/F1b6Z on line 15
Process exited with code 255.
Output for 5.5.35, 5.6.21
Array ( [0] => &#1575; [1] => &#1587; [2] => &#1605; [3] => &#32; [4] => &#1588; [5] => &#1575; [6] => &#1577; [7] => &#32; [8] => &#1593; [9] => &#1605; [10] => &#1585; [11] => &#32; [12] => &#51; [13] => &#51; [14] => &#32; [15] => &#1606; [16] => &#1576; [17] => &#32; [18] => &#32; [19] => &#1606; [20] => &#1593; [21] => &#1605; [22] => &#1604; [23] => &#32; [24] => &#1585; [25] => &#1605; [26] => &#32; [27] => &#1593; [28] => &#1606; [29] => &#32; [30] => &#1606; [31] => &#1608; [32] => &#1575; [33] => &#1585; [34] => &#32; [35] => &#1601; [36] => &#32; [37] => &#1608; [38] => &#1607; ) 1575<br> Fatal error: Call to undefined function iconv() in /in/F1b6Z on line 15
Process exited with code 255.