3v4l.org

run code in 300+ PHP versions simultaneously
<?php function nothingspecial($dings) { $dinging = function ($ding) { $ding = preg_replace("/[^- ()\.\&,_'´`áàäçéèêñóòôöüæøåìíùúâêîôûÁÀÄÇÉÈÊÑÓÒÔÖÜÆØÅÌÍÙÚÂÊÎÔÛß@€:0-9a-zA-Z&+]/", " ", $ding ); $ding = stripslashes(trim(str_replace("'","´",$ding))); $funduz = array('&auml ','&ouml ','&uuml ','&Auml ','&Ouml ','&Uuml ','&szlig '); $ersetzuz = array('ä','ö','ü','Ä','Ö','Ü','ß'); $ding = str_replace($funduz, $ersetzuz, $ding); return $ding; }; return is_array($dings) ? array_map($dinging, $dings) : $dinging($dings); } function old_nothingspecial($dings) { $dings = preg_replace("/[^- ()\.\&,_'´`áàäçéèêñóòôöüæøåìíùúâêîôûÁÀÄÇÉÈÊÑÓÒÔÖÜÆØÅÌÍÙÚÂÊÎÔÛß@€:0-9a-zA-Z&+]/"," ", $dings); $dings = stripslashes(trim(str_replace("'","´",$dings))); $funduz = array('&auml ','&ouml ','&uuml ','&Auml ','&Ouml ','&Uuml ','&szlig '); $ersetzuz = array('ä','ö','ü','Ä','Ö','Ü','ß'); $dings = str_replace($funduz,$ersetzuz,$dings); return $dings; } var_dump(old_nothingspecial(['DópÂ\n'])); var_dump(old_nothingspecial('DópÂ\n'));
Output for 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
Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /in/gZ4Hp:26 Stack trace: #0 /in/gZ4Hp(26): trim(Array) #1 /in/gZ4Hp(33): old_nothingspecial(Array) #2 {main} thrown in /in/gZ4Hp on line 26
Process exited with code 255.
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 Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /in/gZ4Hp:26 Stack trace: #0 /in/gZ4Hp(26): trim(Array) #1 /in/gZ4Hp(33): old_nothingspecial(Array) #2 {main} thrown in /in/gZ4Hp on line 26
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: trim() expects parameter 1 to be string, array given in /in/gZ4Hp on line 26 string(0) "" string(8) "Dóp n"

preferences:
179.75 ms | 402 KiB | 198 Q