手记

php入门之数组函数(1)

<?php
/
implode() 把数组组合成字符串
explode() 把字符串分割成数组
in_array() 检测内容是否在数组中
each()把数组元素拆分成新的数组
list() 把数组元素赋值给变量
/
echo "<pre>";
/
$arr = array("PHP课程","DIVCSS课程","JQUERY","JAVASCRIPT");
$str = implode(":",$arr);
//echo $str;
echo "<pre>";
$file=array('/uploads/a1.jpg','/uploads/a2.jpg','/uploads/a3.jpg');
print_r($file);
$files = implode(',',$file);
echo $files."
";
$arr2 = explode(',',$files);
print_r($arr2);
/
/
$arr3 = array(1,2,3,4,5);
var_dump(in_array('1',$arr3));
/
/
$arr4 = array("url"=>"bbs.houdunwang.com","webname"=>"后盾网论坛");
$arr4_1 = each($arr4);
print_r($arr4_1);
$arr4_1 = each($arr4);
print_r($arr4_1);
var_dump(each($arr4));
/
/
$arr5 = array("url"=>"bbs.houdunwang.com","webname"=>"后盾网视频教程","class1"=>"PHP","class2"=>"DIVCSS");
while(list($k,$v) = each($arr5)){
echo $k."=>".$v;
echo "
";
}
/

0人推荐
随时随地看视频
慕课网APP