3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 5.2.5 - 5.6.28, 7.0.0 - 7.1.0
Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /in/GO0AL on line 6
Output for hhvm-3.10.0 - 3.12.0
Warning: Delimiter must not be alphanumeric or backslash in /in/GO0AL on line 6
Output for 4.3.11 - 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