• PHP is server side scripting system
– PHP stands for "PHP: Hypertext Preprocessor"
– Syntax based on Perl, Java, and C
– Very good for creating dynamic content
– Powerful, but somewhat risky!
– If you want to focus on one system for dynamic content, this is a good one to choose
- Typically file ends in .php - this is set by the web server configuration
- Separated in files with the <?php ?> tag
- php commands can make up an entire file, or can be contained in html - this is a choice….
- Program lines end in ";" or you get an error
- Server recognizes embedded script and executes
- Result is passed to browser, source isn't visible
- We've talk about how the browser can read a text file and process it, that's a basic parsing method
- Parsing involves acting on relevant portions of a file and ignoring others
- Browsers parse web pages as they load
- Web servers with server side technologies like php parse web pages as they are being passed out to the browser
- Parsing does represent work, so there is a cost
- You can embed sections of php inside html:
<?php $myvar = "Hello World!";
- Or you can call html from php:
What do we know already?
$name = "bil";
echo "Howdy, my name is $name";
echo "What will $name be in this line?";
echo 'What will $name be in this line?';
echo 'What's wrong with this line?';
if ($name == "bil")
// Hey, what's this?
echo "got a match!";