3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testValue = str_repeat('A', 100000); function testXML($enc, $val) { $xml = new DomDocument('1.0', $enc); $xml->appendChild($xml->createElement('foo', $val)); $xml = $xml->saveXML(); $xml2 = new DomDocument('1.0', $enc); $xml2->loadXML($xml); return strlen($xml2->firstChild->nodeValue); } function d($enc, $size) { echo sprintf("%25s -> %s\n", $enc, $size); } d('Original size', strlen($testValue)); d('BIG-5', testXML('BIG-5', $testValue)); d('SHIFT-JIS', testXML('SHIFT-JIS', $testValue)); d('SHIFT_JIS', testXML('SHIFT_JIS', $testValue)); d('Shift_JIS', testXML('Shift_JIS', $testValue)); d('UTF-8', testXML('UTF-8', $testValue)); d('ASCII', testXML('ASCII', $testValue)); d('ISO-8859-1', testXML('ISO-8859-1', $testValue));
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Original size -> 100000 BIG-5 -> 100000 SHIFT-JIS -> 100000 SHIFT_JIS -> 100000 Shift_JIS -> 100000 UTF-8 -> 100000 ASCII -> 100000 ISO-8859-1 -> 100000
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Original size -> 100000 BIG-5 -> 100000 SHIFT-JIS -> 100000 SHIFT_JIS -> 100000 Shift_JIS -> 100000 UTF-8 -> 100000 ASCII -> 100000 ISO-8859-1 -> 100000

preferences:
200.75 ms | 402 KiB | 191 Q