function userSales($s) { if (!isset($_SESSION['user_id'])) { header("Location: index.html"); exit(); } sales($s,$_SESSION['user_id']); }
} } function general() { if ($_SESSION['general'] == '1') { include 'sections/general.php'; } } function engineering() { if ($_SESSION['engineering'] == '1') { include 'sections/engineering.php'; } } function sales() { if ($_SESSION['sales'] == '1') { include 'sections/sales.php'; } } function construction() { if ($_SESSION['construction'] == '1') { include 'sections/construction.php'; } } general(); admin(); engineering(); sales(); construction();
function rent($s) { sales($s,null,REALTY_STATUS_RENT); }
</head> <body> <?php function sales($string = '') { $array = array('apple', 'orange', 'grape', 'pear', 'peach', 'mango'); if ($string) { $result = in_array($string, $array); } else { $result = ''; } return array($array, $result); } // 果物リストを取得する list($list, ) = sales(); echo '<p>お買い得フルーツ一覧<br>'; foreach ($list as $value) { echo $value . '<br>'; } echo '</p>'; // 果物リストにappleがあるか調べる list(, $result) = sales('apple'); echo '<p>appleはお買い得フルーツ一覧にありますか?<br>'; if ($result == true) { echo '見つかりました!'; } echo '</p>'; ?> </body> </html>