Php trim string at a particular character

前端 未结 7 1342
花落未央
花落未央 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.

提交回复
热议问题