How to remove first pattern match when string content "/"
$a = "abc/def";
$b = "abc/def/ghi/abc/def";
$result = "/ghi/abc/def"; when replace with "abc/def" only look for the fist match
I try this but is not work.
$x = preg_replace('/'.$a.'/', '', $b, 1);