This article mainly introduces the usage of the php string segmentation function. The example analyzes the usage skills of the explode and split functions in php, which is very useful. For more information, see
This article mainly introduces the usage of the php string segmentation function. The example analyzes the usage skills of the explode and split functions in php, which is very useful. For more information, see
This example describes the usage of the php string segmentation function. Share it with you for your reference. The specific analysis is as follows:
The explode and split functions in php are used to split strings.
The explode function syntax is as follows:
Explode (substring, string)
The explode function is split by a substring, which is more efficient than split. The syntax of the split function is as follows:
Split (pattern, string)
Split splits strings using regular expressions, which is less efficient than explode, but powerful.
<? Php $ list = explode ("_", "php_strting_function.html"); print ("explode () returns: \ n"); print_r ($ list ); $ list = split ("[_.] "," php_strting_function.html "); print (" split () returns: \ n "); print_r ($ list);?>
The output result is as follows:
Explode () returns: Array ([0] => php [1] => strting [2] => function.html) split () returns: array ([0] => php [1] => strting [2] => function [3] => html)
I hope this article will help you with php programming.
,