????:<?php//索引數(shù)組$str=["亢龍有悔" ,"飛龍在天","龍興日安心","縣龍在天","潛龍勿用"];//關(guān)聯(lián)數(shù)組$guanlian = ["name"=>"郭靖","position"=>"金島駙馬&q
<?php
//索引數(shù)組
$str=["亢龍有悔" ,"飛龍在天","龍興日安心","縣龍在天","潛龍勿用"];
//關(guān)聯(lián)數(shù)組
$guanlian = ["name"=>"郭靖","position"=>"金島駙馬"."skill'=>'降龍第八章"];
$swean = [];
$swean["name"]="楊過";
$swean["position"]="daxia";
$swean["skill"]="xiaohunzhan";
echo $str[4];
echo "<hr>";
//for 循環(huán)
$res1="";
for ($i=0;$i<count($str);$i++){
$res1 .=$str[$i] .",";
}
echo $res1,"<hr>";
echo rtrim($res1,",");
echo "<hr>";
//while
$res2="";
$i=0;
while ($i<count($str)){
$res2 .=$str[$i] ."*";
$i++;
}
echo $res2,"<hr>";
echo rtrim($res2,"*");
echo "<hr>";
//foeeach
foreach ($guanlian as $key=>$value);
{
echo $key, "=>" ,$value,"<hr>";
}
?? ???:韋小寶?? ??:2019-03-06 15:41:30
???? ??:寫的很不錯 foreach多用于數(shù)組的遍歷 for很多地方都可以使用到 實際上for和while是沒差的