Documente Academic
Documente Profesional
Documente Cultură
PHP Introduction
Agenda
1.
1.Brief
Brief History
Historyof
ofPHP
PHP
2.
2.Getting
Gettingstarted
started
3.
3.Examples
Examples
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
echo "Hi, I'm a PHP script!";
?>
</body>
</html>
PHP
Software
Free
Platform
Free (Linux)
Development Tools
Free
PHP Coder, jEdit
Getting Started
1.
PHP parses a file by looking for one of the special tags that
tells it to start interpreting the text as PHP code. The parser then
executes all of the code it finds until it runs into a PHP closing tag.
HTML
PHP CODE
HTML
<?php
?>
<?
?>
<script language="php">
?>
<%
%>
Getting Started
1.
Copy the code onto your web server and save it as test.php.
You should see Hello World! displayed.
Notice that the semicolon is used at the end of each line of PHP
code to signify a line break. Like HTML, PHP ignores whitespace
between lines of code. (An HTML equivalent is <BR>)
Getting Started
1.
<?php
$today_dayofweek = date(w);
if ($today_dayofweek == 4){
echo Today is Thursday!;
}
else{
echo Today is not Thursday.;
}
?>
Getting Started
1.
Getting Started
1.