-
Notifications
You must be signed in to change notification settings - Fork 0
/
lab1.html
80 lines (71 loc) · 2.07 KB
/
lab1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php /* this file allows you to view the php source file
* by adding a ?source at the end of the file name
/ `.
J | Dr. Zoidberg (by M-K)
(,)(,) |
L7 -- |
((((> |
L::::J
*/
include_once('../printable.php');
?>
<html>
<head>
<title>A PHP Example</title>
</head>
<body>
<a href="../index.php" target="_blank">Link to index.php</a>
<h3>Lab 1</h3>
<?php
//Course: CS 130A
/*Assignment: Lab 1 (lab1.php)
Student: USERNAME
*/
#Date completed: The Date
?>
<?php //Defining my constants
define('EOL',"<br />\n"); #creates pretty line breaks in markup
?>
<?php //Defining my variables
$myName = "Kia Lam";
echo 'Name: '.$myName.EOL;
$className = "CS 130a PHP Programming";
echo 'Class: '.$className.EOL;
$assignmentNum = "1";
echo 'Assignment: '.$assignmentNum.EOL;
print date('M j, Y');
$demo = 'DEMO';
$browser = $_SERVER['HTTP_USER_AGENT'];
?>
<?php echo EOL;?><br />
<h3>Single Quoted</h3>
<?php
echo 'All PHP variables begin with a "$" character.'.EOL;
echo 'We\'re learning about proper quoting using double quotes (") and single quotes (\').'.EOL;
echo 'We can print variables inside of double-quoted strings. For example: $demo.'.EOL;
?>
<br />
<h3>Double Quoted</h3>
<?php
echo "All PHP variables begin with a \"$\" character.".EOL;
echo "We're learning about proper quoting using double quotes (\") and single quotes (').".EOL;
echo "We can print variables inside of double-quoted strings. For example: $demo.".EOL;
?>
<br />
<h3>HEREDOC</h3>
<?php echo <<<EOD
All PHP variables begin with a "$" character.
We're learning about proper quoting using double quotes (") and single quotes (').
We can print variables inside of double-quoted strings. For example: $demo.
EOD;
?>
<h3>$_SERVER</h3>
<?php
print_r(get_defined_vars());
print_r($_SERVER);
?></p>
<p><?php
print "Hello, I see that you are using $browser.";
?></p>
</body>
</html>