PHPexplode () string conversion array. There are many ways to convert strings into arrays in php. if there is regularity, we can directly use the explode () function to cut strings into arrays. Define and use the explode () function to convert strings into arrays in php in many ways. if there is regularity, we can directly use explode () function to cut the string into an array.
Definition and usage
The explode () function separates strings into arrays.
Syntax
Explode (separator, string, limit)
Example
In this example, we split the string into an array:
The code is as follows: |
|
$ Str = "Hello world. It's a beautiful day ."; Print_r (explode ("", $ str )); ?> |
Output:
The code is as follows: |
|
Array ( [0] => Hello [1] => world. [2] => It's [3] => [4] => beautiful [5] => day. ) |
In this way, our characters are converted into arrays according to our settings.
Extract () function to cut the string into an array. Define and use the explode () function...