3v4l.org

run code in 300+ PHP versions simultaneously
<?php function makeCatList($param){ $arResult = array(); $s = array("/[aаА]/ui","/[bбБ]/ui","/[cсС]/ui","/[dдД]/ui","/[eеЕ]/ui","/[tтТ]/ui","/[rрР]/ui","TB"); $r = array("A","B","C","D","E","T","r","Tb",); $param["string"] = preg_replace($s, $r, $param["string"]); if(preg_match_all("/((?:[A-D]1)|(?:[A-D][E]?)|(Tr|Tb))/u", $param["string"], $mCats)){ //unset($mCats[0]); print_r($mCats); return asort($mCats); } else return false; } print_r(makeCatList(array("string"=>"Ав1beс1edeTr")));
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: preg_replace(): Delimiter must not be alphanumeric, backslash, or NUL in /in/GO0AL on line 6 Deprecated: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/GO0AL on line 7
Output for 8.1.0 - 8.1.28
Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /in/GO0AL on line 6 Deprecated: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/GO0AL on line 8
Output for 5.2.5 - 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.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /in/GO0AL on line 6
Output for 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.4
Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /in/GO0AL on line 6 Array ( [0] => Array ( [0] => A [1] => BE [2] => C1 [3] => DE [4] => Tr ) [1] => Array ( [0] => A [1] => BE [2] => C1 [3] => DE [4] => Tr ) [2] => Array ( [0] => [1] => [2] => [3] => [4] => Tr ) ) 1
Output for 4.3.0 - 4.3.10
Warning: Delimiter must not be alphanumeric or backslash in /in/GO0AL on line 6 Array ( [0] => Array ( [0] => A [1] => BE [2] => C1 [3] => DE [4] => Tr ) [1] => Array ( [0] => A [1] => BE [2] => C1 [3] => DE [4] => Tr ) [2] => Array ( [0] => [1] => [2] => [3] => [4] => Tr ) ) 1

preferences:
256.83 ms | 402 KiB | 425 Q