首页 > 代码库 > 这样就算会了PHP么?-4
这样就算会了PHP么?-4
数组初步
<?php $ereg = ‘tm‘; $str = ‘hello,tm,Tm,tM,TM.‘; $rep_str = eregi_replace($ereg, ‘TM‘, $str); echo $rep_str; echo ‘<br>‘; $ereg2 = ‘is‘; $str2 = ‘This is a register book.‘; $arr_str2 = split($ereg2, $str2); var_dump($arr_str2); echo ‘<br>‘; $array = array("asp", "php", "jsp"); print_r($array); echo ‘<br>‘; echo $array[0]; echo ‘<br>‘; $array2 = array("1"=>"编", "2"=>"程", "3"=>"词", "4"=>"典"); print_r($array2); echo ‘<br>‘; echo $array2[1]; $array2[5] = "好"; echo ‘<br>‘; print_r($array2); echo ‘<br>‘; $newarray = array("first"=>1,"second"=>2, "third" => 3); echo $newarray["second"]; $newarray["third"] = 8; echo $newarray["third"]; echo ‘<br>‘; foreach ($array2 as $array2s) { echo $array2s.‘<br><br>‘; } while (list($num, $value) = each($newarray)) { echo "$num = $value<br>"; }?>
这样就算会了PHP么?-4
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。