阿摩線上測驗 登入

申論題資訊

試卷:113年 - 113 地方政府公務、離島地區公務特種考試_四等_資訊處理:程式設計概要#124356
科目:程式設計
年份:113年
排序:9

申論題內容

四、(一)請說明下列二個 PHP 程式的輸出結果。(8 分)
1.
<!DOCTYPE html>
<html>
<body>
<?php
$i = 1;
while ($i < 6) {
if($i == 3) break;
echo $i;
$i++;
}
?>
</body>
</html>


2.
<!DOCTYPE html>
<html>
<body>


<?php
$x = 5;
function myTest() {
echo "<p>Variable x inside function is: $x</p>";
}
myTest();
echo "<p>Variable x outside function is: $x</p>";
?>
</body>
</html>