欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-04-21 11:52:52
...
目前PHP函数explode()把字符串分割为数组
explode(separator,string,limit)
separator 必需。规定在哪里分割字符串。
string 必需。要分割的字符串。
limit 可选。规定所返回的数组元素的最大数目。

PHP函数explode()例子

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

输出:

  1. Array
  2. (
  3. [0] => Hello
  4. [1] => world.
  5. [2] => It's
  6. [3] => a
  7. [4] => beautiful
  8. [5] => day.
  9. )

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


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/446303.htmlTechArticle目前 PHP函数explode()把字符串分割为数组 explode(separator,string,limit) separator 必需。规定在哪里分割字符串。 string 必需。要分割的字符串。 l...