php explode()函数实例详解

php explode()函数实例详解

下面的例子中,我们将把一个字符串以数组的形式打散:

<?php
$str = “Hello world. It’s a beautiful day.”;
print_r (explode(” “,$str));
?>

上述代码将输出下面的结果:

Array([0] => Hello[1] => world.[2] => It’s
[3] => a[4] => beautiful[5] => day.)

滚动至顶部