实例说明:<?php $cars=array("奔驰","宝马","奥迪"); echo count($cars); ?>标签含义:count() 函数用于返回数组的长度(元素的数量)源代码运行结果如下:...
实例说明:<?php $cars=array("奔驰","宝马","奥迪"); echo "我喜欢 " . $cars[0] . ", " . $cars[1] . " 和 &qu...
实例说明:<!DOCTYPE html> <html> <body> <?php $date=date_create("2013-03-15"); date_add($date,date_interval_create_from...
实例说明:<?php for ($i=1; $i<=5; $i++) { echo "数字为 " . $i . PHP_EOL; } ?>标签含义:for 循环用于您预先知道脚本需要运行的次数的情况。上面的实例定义一个初始值为 i=1 的循环。...
实例说明:<html> <body> <?php $i=1; do { $i++; echo "The number is " . $i . "<br>"; } while ($i&l...
实例说明:<html> <body> <?php $i=1; while($i<=5) { echo "The number is " . $i . "<br>"; $i++; }...
实例说明:<?php $favcolor="red"; switch ($favcolor) { case "red": echo "你喜欢的颜色是红色!"; break; case "blue...
实例说明:<?php $t=date("H"); if ($t<"10") { echo "Have a good morning!"; } elseif ($t<"20"...
实例说明:<?php $t=date("H"); if ($t<"20") { echo "Have a good day!"; } else { echo "Have a...
实例说明:<?php $t=date("H"); if ($t<"20") { echo "Have a good day!"; } ?>标签含义:if 语句用于仅当指定条件成立时执行代码如...