mercredi 1 avril 2015

Insert string into specific part of another string

I've got a URL as a string, for example:



http://ift.tt/1Dout16


I'd like to add another subfolder to it with PHP, before hello, so it should look like this:



http://ift.tt/1C784y4


I thought about using explode to separate the URL by slashes, and adding another one before the last one, but I'm pretty sure I over complicate it. Is there an easier way?


Aucun commentaire:

Enregistrer un commentaire