CONTROLLING PROGRAM FLOW
Learning
Objectives
At the end of
this topic, you will be able to:
- List the steps to install PHP
- List the conditional statements provided by PHP
- List the control statements provided by PHP
- Explain how arrays, functions and forms are created in PHP
PHP-Introduction
PHP is Hypertext
Preprocessor
- It is a popular server-side scripting language and also a general purpose programming language as it supports Object Oriented Programming features
- Most of the Content Management Software (CMS) like WordPress, Joomla, Drupal, Moodie are built on the backbone of PHP
- PHP code is interpreted using a Web server with PHP processor to generate Web pages
- PHP scripts can be embedded inside HTML document and are usually written on server side, hence it requires Web server to execute them
Install PHP Steps
to
· Install Web server such as XAMPP or WAMP.
· Start the Apache and Tomcat modules.
· The current version of PHP is automatically
installed and is ready to use.
· Go to the directory where the XAMPP or WAMP is
installed.
· Access htdocs folder in it.
· Create a new folder to store the PHP scripts that
you will execute using a Web browser.
Steps to Write
PHP script
Open a Notepad
file.
Type the
following code
<?php
echo
"Welcome!!! to the world of PHP";
?>
Save the file
using extension .php in the new folder created in the htdocs folder.
Open a Web
browser and give the path to the new folder created in htdocs directory
followed by the local server.
For example, If
the folder name created in htdocs 'myprograms' and script file is 'testl.php'
then give the following path.
OUTPUT: