<html>
<body>
$str = "abc ABC";
$pattern = "/((a)b)(c)/i";
if(preg_match_all($pattern, $str, $matches, PREG_PATTERN_ORDER)) {
print_r($matches);
}
</body>
</html>
Array ( [0] => Array ( [0] => abc [1] => ABC ) [1] => Array ( [0] => ab [1] => AB ) [2] => Array ( [0] => a [1] => A ) [3] => Array ( [0] => c [1] => C ) )