Suppose we have such a variable:
$a = "user/category/link/buy/" We need to make this option from this:
$a = "usercategorylinkbuy/" Developments:
strtr($a, array('/' => '')); //Удаляет абсолютно все / внутри переменной And if in the variable $ a initially will not be "/", then it should not be added to the end.
s|/([^/]+)(?=/)|\1|g- alexlz