I want to change a specific character. But the order isn't exact and not only the first one. Here is the variable examples:
- 123_456_789.jpg
- 3210_5325_aa.jpg
- 54321-0888_555_1111.jpg
There are 1000 variables like this. I just want to change all second "_" characters. The result must be like this:
- 123_456x789.jpg
- 3210_5325xaa.jpg
- 54321-0888_555x1111.jpg
I've tried substr and str_replace but I couldn't understand how to do.
Can someone please show me a way to achieve this :)
If the second one is always the last one, you can use
strrpos.If it should be really the second one occurence (independently of real number of occurences), it could be:
The second variant is regex, of course. I've showed you
strpos/strrposvariants due to the question.