I have these type of results from a loop function,
C:/wamp/www/xxx/core/page/
C:/wamp/www/xxx/local/page/
But how can I trim off anything before core or local, so I get these only,
core/page/
local/page/
I use strstr
, but I think it search for a fixed keyword only, I have two, many more keywords to match,
$string = 'C:/wamp/www/xxx/local/page/';
$output = strstr($string, '(local|core)');
var_dump($output);
I tried with preg_replace
,
var_dump(preg_replace('#/(core|local)/.*#si', '/', $string));
it gives me the front part - C:/wamp/www/xxx/