What is PHP?
- PHP stands for Hypertext Preprocessor.
- It is an interpreted language, i.e. there is no need for compilation.
- It is a server-side scripting language.
- PHP is faster than other scripting languages e.g. asp and jsp( Java).
of the equation for dynamically manipulating CSS (Cascading Style Sheets) and HTML, now took on the even more muscular task of handling the client side of the Ajax process.
Under Ajax, web pages perform data handling and send requests to web servers in the background—without the web user being aware that this is going on. No doubt the symbiotic nature of PHP and MySQL helped propel them both forward, but what attracted developers to them in the first place? The simple answer has to be the ease with which you can use them to quickly create dynamic elements on websites.
Mysql using with PHP
MySQL is a fast and powerful, yet easy-to-use, a database system that offers just about anything a website would need in order to find and serve up data to browsers. When PHP allies with MySQL to store and retrieve this data, you have the fundamental parts required for the development of social networking sites and the beginnings of Web 2.0.
With PHP, it’s a simple matter to embed dynamic activity in web pages. When you give pages the .php extension, they have instant access to the scripting language. Therefore, From a developer’s point of view, all you have to do is write code such as the following:
<?php echo " Today is " . date("l") . ". "; ?>
Here’s the latest news.
The opening tells
<?php the web server to allow the PHP program to interpret all the following code up to the ?> tag. Outside of this construct, everything is sent to the client as direct HTML. So the text Here’s the latest news. is simply output to the browser; within the PHP tags, the built-in date function displays the current day of the week
according to the server’s system time.
The final output of the two parts looks like this:
Today is Wednesday. Here's the latest news.
PHP is a flexible language, and some people prefer to place the PHP construct directly next to PHP code, like this:
Today is <?php echo date("l"); ?>.
Here’s the latest news.
There are also other ways of formatting and outputting information, which I’ll explain in the chapters on PHP. The point is that with PHP, web developers have a scripting language that, although not as fast as compiling your code in C or a similar language, is incredibly speedy and also integrates seamlessly with HTML markup.
If you intend to enter the PHP examples in this book to work along with me, you must remember to add
<?phpin front and ?> after them to ensure that the PHP interpreter processes them. To facilitate this, you may wish to prepare a file called example.php with those tags in place.
<< Prev Next >>
3,212 total views, 1 views today