Php tutorial explode split str_split function difference and instance
All three functions split a string into an array, but each has its own usage. Let's take a look at the differences between the php explode split str_split function and the instance.
*/
$ Str = "id_99_cn.html ";
$ Array = explode ('_', $ str );
Print_r ($ array );
/*
Array
(
[0] => id
[1] => 99
[2] => cn.html
)
*/
// Function prototype: array split (string $ pattern, string $ string [, int $ limit])
$ Split = split ('_', $ str );
Print_r ($ split );
/*
Array
(
[0] => id
[1] => 99
[2] => cn.html
)
*/
// The str_split () function string is split into an array.
$ Str_split = str_split ($ str, 2 );
Print_r ($ str_split );
/*
Array
(
[0] => id
[1] => _ 9
[2] => 9 _
[3] => cn
[4] =>. h
[5] => tm
[6] => l
)
This site Original article reprinted indicated from http://www.bKjia. c0m