3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function makeCatList($param){ $arResult = array(); $s = array("@[aаА]@u","@[bвВбБ]@u","@[cсС]@u","@[dдД]@u","@[eеЕ]@u","@[tтТ]@u","@[rрР]@u","@TB@u"); $r = array("A","B","C","D","E","T","r","Tb"); $param["string"] = preg_replace($s, $r, $param["string"]); echo $param["string"]; if(preg_match_all("/((?:[A-D]1)|(?:[A-D][E]?)|(Tr|Tb))/u", $param["string"], $mCats)){ sort($mCats[0]); return $mCats[0]; } else return false; } $a = makeCatList(array("string"=>"dвсАв1beс1edeTr")); print_r($a);
Output for 4.3.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
DBCAB1BEC1EDETrArray ( [0] => A [1] => B [2] => B1 [3] => BE [4] => C [5] => C1 [6] => D [7] => DE [8] => Tr )
Output for 4.3.0 - 4.3.2
D�B�C�A�B1BE�C1EDETrArray ( [0] => A [1] => B [2] => B1 [3] => BE [4] => C [5] => C1 [6] => D [7] => DE [8] => Tr )