You are on page 1of 21

Advanced Web

Development

ICT311(3)

Prerequisites to PHP

HTML
CSS
Java Script
MySQL

Recommended Reading
http://php.net
http://www.w3schools.com/php/

Web Development
Web development is a work involved in developing a
web site
Developing the simplest static single page to the most
complex web sites.
Ex-: web-based internet applications, electronic
businesses, social network services, etc.
web development commonly refers web engineering,
web design, web content development, clientside/server-side scripting, web server and network
security configuration, and e-commerce development.

Contd
Among web professionals, "web
development" usually refers to the main
non-design aspects of building web sites:
writing markup and coding.
Most recently Web development has come
to mean the creation of content
management systems or CMS.

Static Vs Dynamic
Find what are the differences of static
& dynamic web development.

Widely used Languages for


Dev.

JavaScript
Java
Python
CSS
PHP
Ruby
C++
C
C#
Objective C
Perl
Etc

Widely used Dev. Tools


Open Source
Eclipse, NetBeans, Notepad++, Visual
Studio Code, etc

Freeware
Visual Studio Express, Google Wed
Designer, Html-Kit, etc

Commercial
Adobe Dreamweaver, Komodo IDE,
Visual Studio, etc

What is PHP?

Hypertext Processor
Open source Server-side Language
Widely used for web development
Easy to embed into HTML

Example
<html>
<head>
<title></title>
</head>
<body>
<?phpecho'<p>HelloWorld</p>';?>

</body>
</html>

PHP Routing Schema

What can PHP do?

Collect form data


Generate dynamic content
Handle files
Send and receive cookies
Command line scripting
Create desktop application
Etc.

Setting up PHP
1. Install a server (Apache, IIS)
2. Install PHP
3. Install database (MySQL, MariaDB,
Oracle, Microsoft SQL, etc)

Configuration on Windows
Download all-in-one package
(WAMP, XAMPP)

Follow the installation instruction


while installation.
Start the server
Test running
IP Address (127.0.0.1, localhost)

PHP Syntax

<?php
// php code here

?>
.php extension used to save PHP file.
Ex-: index.php, about-us.php

Example
<?php
echo I am learning PHP;
?>
<?php
echo $_SERVER[HTTP_USER_AGENT];
?>
<?php
echo $_SERVER[REMOTE_ADDR];
?>

Variables
Variable refers as a data holder or
container.
It can store data and can reuse again
and again.
Data can be a number or a string.
$no = 1;
$userName = Bernard;

Rules to define a PHP


variable
Start with a $ sign.
Must start with a letter or an
underscore.
Name must be unique.
Ex-: $age;
$name;
$myNumber;
$Name;

Assign value to PHP variable


Add assignment operator after variable name.
php use equal sign (=) as assignment operator

Assign data after = sign.


String values must be enclosed with
.
Use ; to define end of the line.
Ex-: $age = 10;
$name = Amal;
$myNumber= 156;
$Name = Brian;

or

Apply Comments in PHP


PHP comment use to inactive block of
codes.
It is not executed when run the PHP file.
Syntax
// this is single line comment
/* this is
multiline comment
*/

Concatenation in PHP
Used to combine strings together.
Dot sign (.) use as concatenate
operator.
Ex-:
echo "php" . " " . "is" . " " . "easy" . " " . "to". " ".
"learn";
$age = 60;
echo "I'm" ." ". $age ." ". "years old!";

You might also like