gpt-3.5-turbo-0301· openai
Suzhen/CodeChat
php how string with separator ";" to array
- User
php how string with separator ";" to array
- Assistant
You can use the explode() function in PHP to convert a string with separator ";" to an array. Here is an example:
$string = "apple;banana;orange"; $array = explode(";", $string); print_r($array);Output:
Array ( [0] => apple [1] => banana [2] => orange )In this example, the explode() function takes two arguments: the separator ";" and the string to be converted. It returns an array containing the substrings of the original string split by the separator.