php脚本的后面名为.php,代码放置在下面的括号里面:

<"htmlcode">
<"hallo world";
"htmlcode">
<"htmlcode">
<!DOCTYPE html>
<html>
<body>

<"Hello World!<br>";
echo "Hello World!<br>";
EcHo "Hello World!<br>";
"htmlcode">
<"red";
$Color="black";
echo "my car is " . $color . "<br>";
echo "my car is " . $Color . "<br>";
"htmlcode">
<"<p>测试函数内部的变量:</p>";
 echo "变量 x 是:$x";
 echo "<br>";
 echo "变量 y 是:$y";
} 

myTest();

echo "<p>测试函数之外的变量:</p>";
echo "变量 x 是:$x";
echo "<br>";
echo "变量 y 是:$y";
"htmlcode">
<"htmlcode">
<"htmlcode">
<"htmlcode">
<"Hello world!","world");
"htmlcode">
<"GREETING", "Welcome to W3School.com.cn!");
echo GREETING;
"htmlcode">
<"H");

if ($t<"10") {
 echo "Have a good morning!";
} elseif ($t<"20") {
 echo "Have a good day!";
} else {
 echo "Have a good night!";
}
"htmlcode">
<"Number 1";
 break;
case 2:
 echo "Number 2";
 break;
case 3:
 echo "Number 3";
 break;
default:
 echo "No number between 1 and 3";
}
"htmlcode">
<"red","green","blue","yellow"); 

foreach ($colors as $value) {
 echo "$value <br>";
}
"function" 开头:

function functionName() {
  被执行的代码;
}
举个例子:

<"Hello world!";
}

writeMsg(); // 调用函数
"$fname Zhang. Born in $year <br>";
}

familyName("Li","1975");
familyName("Hong","1978");
familyName("Tao","1983");
"The height is : $minheight <br>";
}

setHeight(350);
setHeight(); // 将使用默认值 50
setHeight(135);
setHeight(80);
"5 + 10 = " . sum(5,10) . "<br>";
echo "7 + 13 = " . sum(7,13) . "<br>";
echo "2 + 4 = " . sum(2,4);
"htmlcode">
$cars=array("Volvo","BMW","SAAB");
<"Volvo","BMW","SAAB");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
"Volvo","BMW","SAAB");
echo count($cars);
"Volvo","BMW","SAAB");
$arrlength=count($cars);

for($x=0;$x<$arrlength;$x++) {
 echo $cars[$x];
 echo "<br>";
}
"htmlcode">
$age=array("Peter"=>"35","Ben"=>"37","Joe"=>"43");

$age['Peter']="35";
$age['Ben']="37";
$age['Joe']="43";

<"Bill"=>"35","Steve"=>"37","Peter"=>"43");
echo "Peter is " . $age['Peter'] . " years old.";
"Bill"=>"35","Steve"=>"37","Peter"=>"43");

foreach($age as $x=>$x_value) {
 echo "Key=" . $x . ", Value=" . $x_value;
 echo "<br>";
}
"htmlcode">
<"Bill"=>"35","Steve"=>"37","Peter"=>"43");
asort($age);
"Bill"=>"35","Steve"=>"37","Peter"=>"43");
ksort($age);
"post" 的 HTML 表单后的表单数据。也常用于传递变量。
  
  • $_GET:$_GET 也可用于收集提交 HTML 表单 (method="get") 之后的表单数据。
  • $_FILES
  • $_ENV
  • $_COOKIE
  • $_SESSION
  • 其他内容可以在表单处理中找到。

    标签:
    PHP,语法

    免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
    狼山资源网 Copyright www.pvsay.com

    评论“PHP编程基本语法快速入门手册”

    暂无“PHP编程基本语法快速入门手册”评论...

    稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

    昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

    这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

    而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?