About the usage of PHP split string explode function, use the explode function to split the string into an array, here are a few examples summarized for you , friends in need can refer to it.
PHP array and explode function application examples for your study and reference.
Example 1:
?
2 3
4 5
7 8 9 10 11 12 13
|
$province = array("Beijing","Shanghai","Tianjin","Chongqing","Hebei","Shanxi","Inner Mongolia","Liaoning","Jilin","Heilongjiang","Jiangsu ","Zhejiang","Anhui","Fujian","Jiangxi","Shandong","Henan","Hubei","Hunan","Guangdong","Guangxi","Hainan","Sichuan", "Guizhou", "Yunnan", "Tibet", "Shaanxi", "Gansu", "Ningxia", "Qinghai", "Xinjiang", "Hong Kong", "Macau", "Taiwan", "Others");
echo count($province);//Number of array members
echo " "; if(is_array($province)){//Check whether the variable is an array |
1 2 3 4 5 6 7 8 9 | "; } ?> |
1 2 3 4 5 6 7 |
<🎜>//The function is quite practical<🎜>
<🎜>// The separator can be a slash, dot, or horizontal line <🎜>
<🎜>$date = "04/30/1973";<🎜>
<🎜>list($month, $day, $year) = split ('[/.-]', $date);<🎜>
<🎜>echo "Month: $month; Day: $day; Year: $year n"; ?> |