PHP: equivalent of MySQL's function SUBSTRING_INDEX ?

前端 未结 5 507
南方客
南方客 2021-01-18 01:20

I love the SUBSTRING_INDEX function in MySQL, especially because you can use negative indexes to start searching from the right side of the string.

Is there an equiv

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-18 02:02

    I think

    string strstr ( string $haystack , mixed $needle [, bool $before_needle = false ] )
    

    is the right php function for you.

    strstr — Finds the first occurrence of a string

    
    

提交回复
热议问题