if..endif 语法

it2022-05-05  106

使用 if(); elseif(); else; endif; 这一系列复杂的语句无助于 PHP 3.0 解析器的效率。因此,语法改变为:

Example#1 移植:旧有 if..endif 语法

if ($foo);    echo "yep\n";elseif ($bar);    echo "almost\n";else;    echo "nope\n";endif;

Example#2 移植:新的 if..endif 语法

if ($foo):    echo "yep\n";elseif ($bar):    echo "almost\n";else:    echo "nope\n";endif;

注意,在所有的声明中分号均改为冒号,除了末尾的 endif 以外。

原文:http://php.chinaunix.net/manual/zh/migration.if-endif.php

转载于:https://www.cnblogs.com/zsmynl/p/3554985.html


最新回复(0)