if文08



endifを使う


  • 条件のあとに「」コロンをつける
  • endifのあとに「セミコロンをつける



ソースコードPHP

<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>endifを使う</title>
</head>
<body>

<?php $num = 10; ?>
ようこそ。

<hr>

<?php if($num <= 0): ?>
在庫切れです。

<?php elseif($num <= 3): ?>
在庫が僅少です。

<?php else: ?>
在庫があります。

<?php endif; ?>

<hr>

ごゆっくりお過ごしください。

</body>
</html> 


eclipseの内部ブラウザで表示【 chrome