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
    桃源资源网 Design By www.nqtax.com

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

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

    P70系列延期,华为新旗舰将在下月发布

    3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

    而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

    根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。