3v4l.org

run code in 300+ PHP versions simultaneously
<?php function utf8ToLocalEncoding($s) { if (substr(PHP_OS, 0, 3) === 'WIN' || true) { list(, $code) = explode(".", setlocale(LC_CTYPE, 0)); $s = @iconv("UTF-8", "cp" . $code . "//TRANSLIT", $s); } return $s; } function localEncodingToUtf8($s) { if (substr(PHP_OS, 0, 3) === 'WIN' || true) { list(, $code) = explode(".", setlocale(LC_CTYPE, 0)); $s = @iconv("cp" . $code . "//TRANSLIT", "UTF-8", $s); } return $s; } $original = "šířéč"; $a = utf8toLocalEncoding($original); $b = localEncodingToUtf8($a); var_dump($original, $a, $b, $original === $b); var_dump(setlocale(LC_CTYPE, 0));
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key 1 in /in/4rv3S on line 5 Warning: Undefined array key 1 in /in/4rv3S on line 13 string(10) "šířéč" bool(false) bool(false) bool(false) string(1) "C"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
45.1 ms | 401 KiB | 8 Q