[Solved] Remove only 3 characters after a specific string
You can use regex to selecting target part of string and run it in preg_replace(). $url = “http://aaa-aaaa.com/bbbb-bbbbbbbbbb-2/it/clients/”; echo preg_replace(“@(.*)\w{2}/([^/]+/)$@”, “$1$2”, $url); See result of code in demo solved Remove only 3 characters after a specific string