3v4l.org

run code in 300+ PHP versions simultaneously
<?php // $base = 'test image with Ümlaäute und spaäe.jpg'; $nameEncodedFromGWT = 'test%20image%20with%20U%CC%88mlaa%CC%88ute%20und%20spaa%CC%88e.jpg'; $nameEncodedFromPHP = 'test%20image%20with%20%C3%9Cmla%C3%A4ute%20und%20spa%C3%A4e.jpg'; // this is encoded with urlencode() / rawurlencode() // using rawurldecode $nameDecodedFromGWTRaw = rawurldecode($nameEncodedFromGWT); $nameDecodedFromPHPRaw = rawurldecode($nameEncodedFromPHP); // using urldecode $nameDecodedFromGWTSimple = urldecode($nameEncodedFromGWT); $nameDecodedFromPHPSimple = urldecode($nameEncodedFromPHP); echo 'Name from GWT: ' . $nameEncodedFromGWT . PHP_EOL . 'Decoded using rawurldecode(): ' . $nameDecodedFromGWTRaw . PHP_EOL . 'Decoded using urldecode(): ' . $nameDecodedFromGWTSimple . PHP_EOL . 'Cleaned name for rawurldecode(): ' . cleanImageName($nameDecodedFromGWTRaw) . PHP_EOL . 'Cleaned name for urldecode(): ' . cleanImageName($nameDecodedFromGWTSimple); echo PHP_EOL . '===============================================' . PHP_EOL; echo 'Name from PHP: ' . $nameEncodedFromPHP . PHP_EOL . 'Decoded using rawurldecode(): ' . $nameDecodedFromPHPRaw . PHP_EOL . 'Decoded using urldecode(): ' . $nameDecodedFromPHPSimple . PHP_EOL . 'Cleaned name for rawurldecode(): ' . cleanImageName($nameDecodedFromPHPRaw) . PHP_EOL . 'Cleaned name for urldecode(): ' . cleanImageName($nameDecodedFromPHPSimple); /** * Uses preg_replace to replace german umlauts */ function cleanImageName($name) { $clean = preg_replace( array( '/\|/', '/[äÄ]/u', '/[öÖ]/u', '/[üÜ]/u', '/ß/', '/([a-zA-Z0-9]+)/i', '/ - /','/ /','/-/','/&/', '/[á|à|À|Á]/u', '/[é|è|É|È]/u', '/[_\x7c-\xff\$\%\=\?\@\(\)§!\|`´\*#;,:\.<>\/"\'#\t\r\n]/' ), array( ' ', 'ae', 'oe', 'ue', 'ss', '$1', ' ', ' ', ' ', 'und', 'a', 'e', ' ', ), $name); return str_replace(' ', '-', $clean); } ?>
Output for 4.3.10 - 4.3.11, 4.4.0 - 4.4.9, 5.0.2 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 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
Name from GWT: test%20image%20with%20U%CC%88mlaa%CC%88ute%20und%20spaa%CC%88e.jpg Decoded using rawurldecode(): test image with Ümlaäute und spaäe.jpg Decoded using urldecode(): test image with Ümlaäute und spaäe.jpg Cleaned name for rawurldecode(): test-image-with-U--mlaa--ute-und-spaa--e-jpg Cleaned name for urldecode(): test-image-with-U--mlaa--ute-und-spaa--e-jpg =============================================== Name from PHP: test%20image%20with%20%C3%9Cmla%C3%A4ute%20und%20spa%C3%A4e.jpg Decoded using rawurldecode(): test image with Ümlaäute und spaäe.jpg Decoded using urldecode(): test image with Ümlaäute und spaäe.jpg Cleaned name for rawurldecode(): test-image-with-uemlaaeute-und-spaaee-jpg Cleaned name for urldecode(): test-image-with-uemlaaeute-und-spaaee-jpg
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 Name from GWT: test%20image%20with%20U%CC%88mlaa%CC%88ute%20und%20spaa%CC%88e.jpg Decoded using rawurldecode(): test image with Ümlaäute und spaäe.jpg Decoded using urldecode(): test image with Ümlaäute und spaäe.jpg Cleaned name for rawurldecode(): test-image-with-U--mlaa--ute-und-spaa--e-jpg Cleaned name for urldecode(): test-image-with-U--mlaa--ute-und-spaa--e-jpg =============================================== Name from PHP: test%20image%20with%20%C3%9Cmla%C3%A4ute%20und%20spa%C3%A4e.jpg Decoded using rawurldecode(): test image with Ümlaäute und spaäe.jpg Decoded using urldecode(): test image with Ümlaäute und spaäe.jpg Cleaned name for rawurldecode(): test-image-with-uemlaaeute-und-spaaee-jpg Cleaned name for urldecode(): test-image-with-uemlaaeute-und-spaaee-jpg
Output for 4.3.3 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 17 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 18 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 19 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 20 Name from GWT: test%20image%20with%20U%CC%88mlaa%CC%88ute%20und%20spaa%CC%88e.jpgPHP_EOLDecoded using rawurldecode(): test image with Ümlaäute und spaäe.jpgPHP_EOLDecoded using urldecode(): test image with Ümlaäute und spaäe.jpgPHP_EOLCleaned name for rawurldecode(): test-image-with-U--mlaa--ute-und-spaa--e-jpgPHP_EOLCleaned name for urldecode(): test-image-with-U--mlaa--ute-und-spaa--e-jpg Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 23 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 23 PHP_EOL===============================================PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 25 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 26 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 27 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 28 Name from PHP: test%20image%20with%20%C3%9Cmla%C3%A4ute%20und%20spa%C3%A4e.jpgPHP_EOLDecoded using rawurldecode(): test image with Ümlaäute und spaäe.jpgPHP_EOLDecoded using urldecode(): test image with Ümlaäute und spaäe.jpgPHP_EOLCleaned name for rawurldecode(): test-image-with-uemlaaeute-und-spaaee-jpgPHP_EOLCleaned name for urldecode(): test-image-with-uemlaaeute-und-spaaee-jpg
Output for 4.3.0 - 4.3.2
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 17 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 18 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 19 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 20 Name from GWT: test%20image%20with%20U%CC%88mlaa%CC%88ute%20und%20spaa%CC%88e.jpgPHP_EOLDecoded using rawurldecode(): test image with Ümlaäute und spaäe.jpgPHP_EOLDecoded using urldecode(): test image with Ümlaäute und spaäe.jpgPHP_EOLCleaned name for rawurldecode(): test-image-with-U-emlaa-eute-und-spaa-ee-jpgPHP_EOLCleaned name for urldecode(): test-image-with-U-emlaa-eute-und-spaa-ee-jpg Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 23 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 23 PHP_EOL===============================================PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 25 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 26 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 27 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NeplW on line 28 Name from PHP: test%20image%20with%20%C3%9Cmla%C3%A4ute%20und%20spa%C3%A4e.jpgPHP_EOLDecoded using rawurldecode(): test image with Ümlaäute und spaäe.jpgPHP_EOLDecoded using urldecode(): test image with Ümlaäute und spaäe.jpgPHP_EOLCleaned name for rawurldecode(): test-image-with--uemla-aeute-und-spa-aee-jpgPHP_EOLCleaned name for urldecode(): test-image-with--uemla-aeute-und-spa-aee-jpg

preferences:
276.39 ms | 405 KiB | 459 Q