mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-05-05 22:38:31 +00:00
commit
bb7d69154d
@ -212,7 +212,7 @@ assert($c >= $d);
|
|||||||
// The following will only be true if the values match and are the same type.
|
// The following will only be true if the values match and are the same type.
|
||||||
assert($c === $d);
|
assert($c === $d);
|
||||||
assert($a !== $d);
|
assert($a !== $d);
|
||||||
assert(1 == '1');
|
assert(1 === '1');
|
||||||
assert(1 !== '1');
|
assert(1 !== '1');
|
||||||
|
|
||||||
// Variables can be converted between types, depending on their usage.
|
// Variables can be converted between types, depending on their usage.
|
||||||
|
@ -180,7 +180,7 @@ assert($c >= $d);
|
|||||||
// 下面的比较只有在类型相同、值相同的情况下才为真
|
// 下面的比较只有在类型相同、值相同的情况下才为真
|
||||||
assert($c === $d);
|
assert($c === $d);
|
||||||
assert($a !== $d);
|
assert($a !== $d);
|
||||||
assert(1 == '1');
|
assert(1 === '1');
|
||||||
assert(1 !== '1');
|
assert(1 !== '1');
|
||||||
|
|
||||||
// 变量可以根据其使用来进行类型转换
|
// 变量可以根据其使用来进行类型转换
|
||||||
@ -243,7 +243,7 @@ if ($x === '0') {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 下面的语法常用语模板中:
|
// 下面的语法常用于模板中:
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ($x): ?>
|
<?php if ($x): ?>
|
||||||
@ -333,7 +333,7 @@ function my_function () {
|
|||||||
echo my_function(); // => "Hello"
|
echo my_function(); // => "Hello"
|
||||||
|
|
||||||
// 函数名需要以字母或者下划线开头,
|
// 函数名需要以字母或者下划线开头,
|
||||||
// 后面可以跟着任意的字幕、下划线、数字.
|
// 后面可以跟着任意的字母、下划线、数字.
|
||||||
|
|
||||||
function add ($x, $y = 1) { // $y 是可选参数,默认值为 1
|
function add ($x, $y = 1) { // $y 是可选参数,默认值为 1
|
||||||
$result = $x + $y;
|
$result = $x + $y;
|
||||||
|
Loading…
Reference in New Issue
Block a user