php explode function for only first white space

前端 未结 5 2089
执笔经年
执笔经年 2021-02-18 19:25

I have a String Hello This is a String. I need to explode it in PHP only for the First White Space. How is that possible?

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

    yes

    just call

    explode(' ',$s, 2)
    

    this will create an array with at most 2 elements

提交回复
热议问题