首页 > php框架 > 解读PHP函数explode()的具体使用方法

解读PHP函数explode()的具体使用方法

目前
PHP函数explode()把字符串分割为数组
explode(separator,string,limit)
separator 必需。规定在哪里分割字符串。
string 必需。要分割的字符串。
limit 可选。规定所返回的数组元素的最大数目。

PHP函数explode()例子
 

  1. <?php 
  2. $str = "Hello world. Its a beautiful day.";  
  3. print_r (explode(" ",$str));  
  4. ?> 

输出:
 

  1. Array  
  2. (  
  3. [0] => Hello  
  4. [1] => world.  
  5. [2] => Its  
  6. [3] => a  
  7. [4] => beautiful  
  8. [5] => day.  

以上代码示例就是PHP函数explode()的具体使用。


本文地址:http://www.phprm.com/frame/php1003668.html

转载随意,但请附上文章地址:-)

标签:none

发表留言