Php trim string at a particular character

前端 未结 7 1344
花落未央
花落未央 2021-01-11 18:32

Is there a php string function to trim a string after a particular character. I had a look on the php.net site and did a google search but couldn\'t find anything. The only

相关标签:
7条回答
  • 2021-01-11 19:24

    Try strtok:

    $token = strtok($str, '?');
    

    Note that the second parameter is a list of separators and not a separator string.

    0 讨论(0)
提交回复
热议问题