PHP Introduction - Learn PHP

PHP: Hypertext Preprocessor or PHP as it is usually called, is a general-purpose scripting language that appeared in 1995 and is widely used to develop dynamic web pages. By dynamic web pages, we mean that the web pages are able to change their behaviour or output to the user based on what it was programmed to do.

PHP code is usually embedded in an HTML document and this code is executed/evaluated on the server (by the PHP interpreter) and generates the output which is sent to the user. PHP is freely available for most modern web servers and may also be used as a standalone application for interpreting PHP scripts that may or may not have to do with web page generation.

Tutorials for beginners to PHP

Tutorials for advanced PHP programmers

String manipulation functions in PHP

What can PHP do?

With PHP you can do a number of things:

  • Create web pages which change their output based on various inputs or parameters.
  • Create large websites more quickly than what could have been done otherwise.
  • Build a variety of online tools.

The fact that you can actually insert small programs into your HTML, means that you actually start having more fine-grained control over the behaviour of your page.

PHP has all the regular things most programmings languages have such as variables, if statements, for loops, writing to files, and string functions.

What does PHP code look like?

Below you can see some sample PHP code:

function printBread($bread)
  if (!empty($bread))
    return '<div class="bread">'. implode(' › ', $bread) .'</div>';
if ($todo == 'yes')
    echo printBread($some_variable);
    echo 'Nothing to do';

PHP is one of the more easily read languages. The PHP syntax does not define the language to have much cryptic commands or symbols, and function names are usually self-explanatory.

Recommended reading

It is recommended that one is familiar with HTML before trying to do web development in PHP. This is because the output from the PHP script will still need to be formatted in such a way that it is properly viewable in a web browser.

If you do not plan to do any web page generation with PHP then it is perfectly fine to ignore HTML altogether.

Link to this Page

Thank Tutorial Arena for This Tutorial.
Show your appreciation with a +1...