码迷,mamicode.com
首页 > Web开发 > 详细

这样就算会了PHP么?-4

时间:2014-10-23 15:52:57      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   ar   for   sp   div   2014   

数组初步

<?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>";
    }
?>

bubuko.com,布布扣

这样就算会了PHP么?-4

标签:style   blog   http   color   ar   for   sp   div   2014   

原文地址:http://www.cnblogs.com/aguncn/p/4045684.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!