0
Please, how can I remove the bar at the end of the URL. For example, I have these variables with the urls below, but I cannot remove the last bar:
<?php
 
 $url1 = 'http://www.site.com.br/domain1/domanin2/nome/';
 $url2 = 'http://www.site.com/';
 $url3 = 'http//www.site.com/diretorio/paginas/pagina/';
 $substituir = str_replace('/', '', $url1); // substitui todas as barras
I don’t want to overwrite all the/bars of the url, only the last one. When the urls are overwritten I would have:
  http://www.site.com.br/domain1/domanin2/nome
  http://www.site.com
  http//www.site.com/diretorio/paginas/pagina
Please, could someone help me?