Converting strings to arrays with PHP
php string array provides three PHP string to array methods, using the function explode str_split split Eval and other functions to give different examples of how to convert the string into an array instance. The
php tutorial string
article provides three PHP string to array methods, using the function explode str_split split Eval and other four functions to give different examples of how to convert a string into an array instance.
*/
$str =.Quot; corn, broccoli, zucchini.quot;
$ar = explode (.Quot; > > >); definition and usage of definitions and usage.
syntax
explode (separator, string, limit) parameters describe
separator necessary. Specify where a string is split.
string is necessary. A string to be split.
limit is optional. The maximum number of array elements that are required to return.
* /
$biuuu ='www.111cn.net';
print_r (str_split ($biuuu))
/*
defines and uses the
function () function to split the string into the array.
syntax
str_split (string, length) parameter describes
string necessary. A string that specifies to be split.
length is optional. The length of each array element is specified. The default is 1.
*/
//
$str=.quot; $str=$str;.Quot;
Eval ($str);
coffee. The function of the Val () function is to return the string corresponding to the PHP code.
$str=.quot; 1:0:1:0:1.quot;
$arraylist=split (.Quot;.Quot; $str); / / / / /