i have a php variable which contain url string like this:
$url1 = 'http://test1.com/';
$url2 = 'https://test2.com';
$url3 = 'http://test3.com/';
i want to replace the http or https prefix with specific string and remove the dash at the end only if the string variable contain dash at the end of the string, for example:
$url1 = 'stackoverflow://test1.com';
$url2 = 'stackoverflow://test2.com';
$url3 = 'stackoverflow://test3.com';
https?echo preg_replace ('/https|http/','stackoverflow','http://test1.com/');https://sdasdahttpol.com/it will replace the http after the https, and how to remove the/in the last string character if only the string last character is/