PHPendifキーワード_
例
条件を終了しif
ます:
<?php
$a = 4;
if($a < 5):
echo "Less than five";
endif;
?>
定義と使用法
endif
キーワードは、構文で開始された条件の終わりを示すために使用されますif
。また、やなど
if(...):
の条件のバリエーションにも適用されます。if
if...elseif
if...else
関連ページ
ifキーワード。
elseキーワード。
elseifキーワード。
PHPの条件文について詳しくは、チュートリアルをご覧ください。
その他の例
例
条件を終了しif...else
ます:
<?php
$a = 4;
if($a < 5):
echo "Less than five";
else:
echo "Greater than five";
endif;
?>
例
条件を終了しif...elseif...else
ます:
<?php
$a = 4;
if($a < 5):
echo "Less than five";
elseif($a < 10):
echo "More than five but less than ten";
else:
echo "Greater than ten";
endif;
?>