Except where otherwise noted, the contents of this presentation are Copyright 2009 Marty Stepp and Jessica Miller.
display property
(4.4.4)
h2 { display: inline; background-color: yellow; }
| property | description |
|---|---|
display
|
sets the type of CSS box model an element is displayed with |
none, inline, block, run-in, compact, ...<ul id="topmenu"> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul>
#topmenu li {
display: inline;
border: 2px solid gray;
margin-right: 1em;
}
visibility property
p.secret {
visibility: hidden;
}
Since nobody can see this anyway: ca-ca poo-poo pee-pee!!!
| property | description |
|---|---|
visibility
|
sets whether an element should be shown onscreen; can be visible (default) or hidden
|
hidden elements will still take up space onscreen, but will not be shown
display to none insteadhttp://server/path/file
https://webster.cs.washington.edu/quote2.php
webster.cs.washington.edu to run the program quote2.php and send back its output

.html file (static content): server just sends that file.php file (dynamic content): server reads it, runs any script code inside it, then sends result across the network
There are many other options for server-side languages: Ruby on Rails, JSP, ASP.NET, etc. Why choose PHP?
The following contents could go into a file hello.php:
<?php print "Hello, world!"; ?>
<?php and ends with ?>
.php page on your local hard drive; you'll either see nothing or see the PHP source code.php file will run the program and send you back its outputprint
(5.2.2)
print "text";
print "Hello, World!\n"; print "Escape \"chars\" are the SAME as in Java!\n"; print "You can have line breaks in a string."; print 'A string can use "single-quotes". It\'s cool!';
echo instead of print$name = expression;
$user_name = "PinkHeartLuvr78"; $age = 16; $drinking_age = $age + 5; $this_class_rocks = TRUE;
$, on both declaration and usage
+ - * / % . ++ --
= += -= *= /= %= .=
5 + "7" is 12# single-line comment // single-line comment /* multi-line comment */
# is also allowed
# comments instead of //# and will use it in our examplesString type
(5.2.6)
$favorite_food = "Ethiopian";
print $favorite_food[2]; # h
. (period), not +
5 + "2 turtle doves" === 75 . "2 turtle doves" === "52 turtle doves""" or ''$age = 16; print "You are " . $age . " years old.\n"; print "You are $age years old.\n"; # You are 16 years old.
" " are interpreted
' ' are not interpreted:
print 'You are $age years old.\n'; # You are $age years old.\n
{}:
print "Today is your $ageth birthday.\n"; # $ageth not found print "Today is your {$age}th birthday.\n";
for loop
(same as Java)
(5.2.9)
for (initialization; condition; update) {
statements;
}
for ($i = 0; $i < 10; $i++) {
print "$i squared is " . $i * $i . ".\n";
}