PHP Chapter 1
PHP Chapter 1
Development
ITSE 3302
تطوير تطبيقات الشبكة العالمية
Dr. Moamar Elyazgi
PHP
Introduction & Syntax Overview
1 Simplicity
2 Efficiency
3 Security
4 Flexibility
5 Familiarity
5
1.4 Script in PHP
• To get a feel of PHP, first start with <html>
<head>
simple PHP scripts.
<title>Hello World</title>
• Since "Hello, World!" is an essential <body>
example, first we will create a <?php
friendly little "Hello, World!" script. echo "Hello, World!";
?>
• As mentioned earlier, PHP is </body>
embedded in HTML. That means </html>
that in amongst your normal HTML
(or XHTML if you're cutting-edge) It will produce the following result:
you'll have PHP statements like this: Hello, World! 6
1.4 Script in PHP
• A PHP file can also contain tags such as HTML and client side
scripts such as JavaScript.
• HTML is an added advantage when learning PHP Language.
You can even learn PHP without knowing HTML but it’s
recommended you at least know the basics of HTML.
• Database management systems DBMS for database powered
applications.
• For more advanced topics such as interactive applications and
web services, you will need JavaScript and XML.
7
1.5 Escaping to PHP
• Escape sequences are used for escaping a character during the string
parsing.
• It is also used for giving special meaning to represent line breaks, tabs,
alert and more.
• The escape sequences are interpolated into strings enclosed by double
quotations or heredoc syntax.
• If a string is within the single quotes or in nowdocs, then the escape
sequence will not work to get the expected result.
• Escape sequences are started with the escaping character backslash (\)
followed by the character which may be an alphanumeric or a special
character. 8
1.5 Escaping to PHP
• Widely used Escape Sequences in PHP
• In this section, I have listed some of the widely used escape sequences and
describe how they are used to escape the special character or to give meaning
by combining with some alphanumeric characters.
<?php