- array_map: documentation ( source)
- preg_match_all: documentation ( source)
- var_export: documentation ( source)
<?php
$strings=[
'e123f654g933c',
'e123f654g933ce99f77g66c'
];
foreach($strings as $string){
var_export(
array_map(
function($v){
return preg_match_all('/[e-g]\d+/',$v,$out2)?$out2[0]:[];
},
preg_match_all('/(?:[e-g]\d+)+(?=c)/',$string,$out1)?$out1[0]:[]
)
);
echo"\n\n";
}