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.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.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
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
161.8 ms | 407 KiB | 5 Q