1 of 11

Web Technologies

Introduction to PHP

Smt.M.Jeevana Sujitha

Assistant Professor

Department of Computer Science and Engineering

SRKR Engineering College, Bhimavaram, A.P. - 534204

2 of 11

OBJECTIVES

The Objectives of this lecture are

  • To learn about introduction to php.

3 of 11

Introduction to PHP

What is PHP?

  • PHP is an acronym for “Hypertext Preprocessor”.
  • PHP is a widely-used, open source scripting language.
  • PHP scripts are executed on the server.
  • PHP is free to download and use.

4 of 11

Introduction to PHP

What is a PHP File?

  • PHP files can contain text, HTML, CSS, JavaScript, and PHP code.
  • PHP code is executed on the server, and the result is returned to the browser as plain HTML.
  • PHP files have extension ".php"

5 of 11

Introduction to PHP

What can PHP DO?

  • PHP can generate dynamic page content.
  • PHP can create, open, read, write, delete, and close files on the server.
  • PHP can collect form data.
  • PHP can send and receive cookies.
  • PHP can add, delete, modify data in your database.
  • PHP can be used to control user-access.
  • PHP can encrypt data.

6 of 11

Introduction to PHP

Why PHP?

  • PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
  • PHP is compatible with almost all servers used today (Apache, IIS, etc.)
  • PHP supports a wide range of databases.
  • PHP is free. Download it from the official PHP resource: www.php.net
  • PHP is easy to learn and runs efficiently on the server side.

7 of 11

Introduction to PHP

PHP Syntax:

  • A PHP script is executed on the server, and the plain HTML result is sent back to the browser.
  • A PHP script can be placed anywhere in the document.
  • A PHP script starts with <?php and ends with ?> Syntax:

<?php Php code

?>

8 of 11

Introduction to PHP

Example:

  • A PHP file normally contains HTML tags, and some PHP scripting code.

<html>

<body>

<h1>My first PHP page</h1>

<?php

echo "Hello World!";

?>

</body>

</html>

9 of 11

Introduction to PHP

Comments in PHP:

  • A comment in PHP code is a line that is not executed as a part of the program.
  • Its only purpose is to be read by someone who is looking at the code.

//This is single line comment #This is also a single line comment

/* This is multi line comment */

10 of 11

Introduction to PHP

PHP Case Sensitivity:

  • In PHP, keywords classes, functions, and user-defined functions

are not case-sensitive.

  • However all variable names are case sensitive. Example:

<html>

<body>

<?php

ECHO "Hello World!<br>"; echo "Hello World!<br>"; EcHo "Hello World!<br>";

?>

</body>

</html>

11 of 11

THANK YOU