作者:孙运动
“ ===” 操作符
------------------------
我们上面已经提到过, PHP4 增加了一个新的 === 操作符来测试是否变量具有相同的类型。这儿有一个例子:
--------------------------------------------------------------------------------
if (!$submit)
{
// 如果$submit不存在, 这暗示表单还没有提交
// 所以显示第一个页面
?>
td {font-family: Arial;}
请输入任何数值或数据
请再输入一些数值或数据
}
else
{
// 如果$submit 确实存在了,表单已经被提交了
// 所以用以下代码处理
if ($yin === $yang)
{
$result = "两个变量值和类型完全相同";
}
else
{
$result = "两个变量值和类型完全不相同";
}
?>
}
?>
--------------------------------------------------------------------------------
选择句法
------------------
PHP对于目前讨论的多种控制结构也支持一种选择句法。例如,你可以这样做:
--------------------------------------------------------------------------------
if ($elvis == 0)
{
echo "Elvis 已经离开了大楼!";
}
else
{
echo "Elvis 还在这儿!";
}
?>
或者你也可以这样做:
if ($elvis == 0):
echo "Elvis 已经离开了大楼!";
else:
echo "Elvis 还在这儿!";
endif;
?>
--------------------------------------------------------------------------------
第二种选择和第一种完全相同,在这种结构中简单的用一个冒号[:]替换第一个大括弧,移去第二个大括弧,使用 "endif"语句来结束。
这些就是第二部分的内容。下次,我们将带给你循环,数组和更多的表单-所以一定不要错过啊!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
