PHP || Introduction of PHP(Hypertext Preprocessor) || Bcisnotes

PHP

 PHP

PHP is an acronym for “PHP: Hypertext Preprocessor”. Itis a general-purpose scripting language especially suited to web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994. The Hypertext Preprocessor reference implementation is now produced by The Hypertext Preprocessor Group. Hypertext Preprocessoris a widely-used, open-source scripting language

What is a Hypertext Preprocessor File?

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

What Can Hypertext Preprocessor Do?

  • It can generate the dynamic page content
  • It can create, open, read, write, delete, and close files on the server
  • It can collect form data
  • It can send and receive cookies
  • It can add, delete, modify data in your database
  • Itcan be used to control user-access
  • It can encrypt data
  • With PHP you are not limited to output HTML. You can output images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML.

 

Why Hypertext Preprocessor?

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

Syntax of Hypertext Preprocessor

<?php

// Hypertext Preprocessor code goes here

?>

Example

<!DOCTYPE html>

<html>

<body>

<h1>My first Hypertext Preprocessor page</h1>

<?php

echo “Hello World!”;

?>

</body>

</html>

Hypertext Preprocessor Case Sensitivity

In Hypertext Preprocessor, keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are not case-sensitive.

In the example below, all three echo statements below are equal and legal:

Example

<!DOCTYPE html>

<html>

<body>

<?php

ECHO “Hello World!<br>”;

echo “Hello World!<br>”;

EcHo “Hello World!<br>”;

?>

</body>

</html>

Look at the example below; only the first statement will display the value of the $color variable! This is because $color, $COLOR, and $coLOR are treated as three different variables:

Example

<!DOCTYPE html>

<html>

<body>

<?php

$color = “red”;

echo “My car is ” . $color . “<br>”;

echo “My house is ” . $COLOR . “<br>”;

echo “My boat is ” . $coLOR . “<br>”;

?>

</body>

</html>

You may also like: introduction of database

Be the first to comment

Leave a Reply

Your email address will not be published.


*