update,
This commit is contained in:
16
it114105/itp4513/Lab01/Lab01_Task1.php
Normal file
16
it114105/itp4513/Lab01/Lab01_Task1.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Lab01 Task1</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
echo "Name: jerry<br>";
|
||||
print ("Age: 18<br>");
|
||||
printf("Weight: %.02f kg", 67);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
21
it114105/itp4513/Lab01/Lab01_Task2.php
Normal file
21
it114105/itp4513/Lab01/Lab01_Task2.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Lab01 Task2</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
$name = "Jerry";
|
||||
$age = 18;
|
||||
$weight = 67;
|
||||
|
||||
echo "Name: $name<br>";
|
||||
print ("Age: $age<br>");
|
||||
printf("Weight: %.02f kg", $weight);
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
22
it114105/itp4513/Lab01/Lab01_Task3.php
Normal file
22
it114105/itp4513/Lab01/Lab01_Task3.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Lab01 Task3</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
$x = 20;
|
||||
$y = 6;
|
||||
|
||||
printf("%s + %s = %d <br>", $x, $y, ($x+$y));
|
||||
printf("%s - %s = %d <br>", $x, $y, ($x-$y));
|
||||
printf("%s * %s = %d <br>", $x, $y, ($x*$y));
|
||||
printf("%s / %s = %f <br>", $x, $y, ($x/$y));
|
||||
printf("%s % %s = %d <br>", $x, $y, ($x%$y));
|
||||
?>
|
||||
</body>
|
||||
</html>
|
23
it114105/itp4513/Lab01/Lab01_Task4.php
Normal file
23
it114105/itp4513/Lab01/Lab01_Task4.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Lab01 Task4</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
$a = 100;
|
||||
$x = $a++;
|
||||
echo "a: " . $a . "<br />";
|
||||
echo "x: " . $x . "<br />";
|
||||
$x = ++$a;
|
||||
echo "a: " . $a . "<br />";
|
||||
echo "x: " . $x . "<br />";
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
28
it114105/itp4513/Lab01/Lab01_Task5.php
Normal file
28
it114105/itp4513/Lab01/Lab01_Task5.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Lab01 Task5</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
$today = getdate(time());
|
||||
echo "Today is $today[mday] $today[month] $today[year] <br />";
|
||||
|
||||
switch($today['mon']) {
|
||||
case 2:
|
||||
$days = (($today['year'] % 4 == 0 && $today['year'] % 100 !=0) || $today['year'] % 400 == 0) ? 29 : 28 ;
|
||||
break;
|
||||
case 4: case 6: case 9: case 11:
|
||||
$days = 30;
|
||||
break;
|
||||
default:
|
||||
$days = 31;
|
||||
}
|
||||
|
||||
echo "$today[month] has $days days.";
|
||||
?>
|
||||
</body>
|
||||
</html>
|
25
it114105/itp4513/Lab01/Lab01_Task6.php
Normal file
25
it114105/itp4513/Lab01/Lab01_Task6.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Task01 Task6</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
$today = getdate(time());
|
||||
echo "Today is $today[mday] $today[month] $today[year] <br />";
|
||||
|
||||
if($today['mon'] == 2)
|
||||
$days = (($today['year'] % 4 == 0 && $today['year'] % 100 !=0) || $today['year'] % 400 == 0) ? 29 : 28 ;
|
||||
else if($today['mon'] == 4 || $today['mon'] == 6 || $today['mon'] == 9 || $today['mon'] == 11)
|
||||
$days = 30;
|
||||
else
|
||||
$days = 31;
|
||||
|
||||
echo "$today[month] has $days days.";
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user