How can I split a delimited string into an array in PHP?

前端 未结 10 1655
失恋的感觉
失恋的感觉 2020-11-21 11:11

I need to split my string input into an array at the commas.

How can I go about accomplishing this?

Input:

9,admin@example.com,8
10条回答
  •  孤独总比滥情好
    2020-11-21 12:05

    $string = '9,admin@google.com,8';
    $array = explode(',', $string);
    

    For more complicated situations, you may need to use preg_split.

提交回复
热议问题