How to find the second-to-last occurrence of a character within a string?

后端 未结 5 1073
别跟我提以往
别跟我提以往 2021-02-07 10:29

If possible, using only standard PHP functions like substr(), strrpos(), strpos(), etc.

5条回答
  •  一整个雨季
    2021-02-07 11:18

    Search for a regexp (plz correct me if I'm wrong, and how to write it in PHP):

        r'x[^x]*x[^x]*$'.replace('x',your_char)
    

提交回复
热议问题