<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <title></title> </head> <body> <?php // 局部变量 $x = 4; function assignx($y) { $x = $y; echo "$x<br>"; } assignx(0); echo $x . "<br>"; // 全局变量 $somevar = 15; function addit() { global $somevar; $somevar++; echo $somevar . "<br>"; } addit(); // 静态变量 function keep_track() { static $count = 0; $count++; echo $count . '<br>'; } keep_track(); keep_track(); keep_track(); $links = array("The Apache Web Server" => "www.apache.org", "Apress" => "www.apress.com"); foreach($links as $title => $link) { echo "<a href="http://$link">$title</a><br>"; } ?> </body> </html>