1 into php
1 into php
PHP
<P>
<?php $myvar = "Hello World!";
echo $myvar;
?>
</P>
Parsing
• 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
Two Ways
• Or
<?php
you can call html from
php:
echo "<html><head><title>Howdy</title>
…
?>
What do we know already?
• Much of what we know about
javascript holds true in php (but
not all!), and other languages as
well
$name = "bil";
echo "Howdy, my name is
$name";
echo "What will $name be in
this line?";
echo 'What's wrong with this
line?';
if ($name == "bil")
{
// Hey, what's this?
Variables
• Typed by context (but one can
force type), so it's loose
• Begin with "$" (unlike
javascript!)
• Assigned by value
• $foo = "Bob"; $bar = $foo;
00
phpinfo()
00_phpinfo.ph
Variable Variables
• Incrementing/Decrementing
• str_replace()
• trim(), ltrim(), rtrim()
• implode(), explode()
• addslashes(), stripslashes()
• htmlentities(),
html_entity_decode(),
htmlspecialchars()
• striptags()
Sources
• http://www.zend.com/zend/
art/intro.php
• http://www.php.net/
• http://hotwired.lycos.com/
webmonkey/programming/php/
index.html