PHP implode and explode functions

PHP implode() function is used to join array elements with a string.

This function can be used whenever you want to represent an array in the form of string separated by some or any delimiter.


orange, grapes, banana, apple

PHP explode() function is used to fetch or get an array of elements from a string separated by some delimiter.



How to remove forbidden or permission denied error on accessing wamp server on localhost?

Forbidden You don’t have permission to access / on this server.

TO RESOLVE THE ABOVE ERROR WE NEED TO MAKE THE FOLLOWING CHANGES IN httpd.conf FILE LOCATED AT for e.g. C:\wamp\bin\apache\apache2.2.22\conf\htpd.conf

Look through the httpd.conf file and make changes as follows:


Try it!
Good Luck :)

PHP Introduction

PHP Introduction and Examples
PHP is a powerful tool for making dynamic and interactive Web pages. PHP is the widely-used, free, and efficient in developing web applications.

  1. PHP stands for Hypertext Preprocessor
  2. PHP is a server-side scripting language, like ASP
  3. PHP scripts are executed on the server
  4. PHP supports many databases (MySQL, Oracle, PostgreSQL, etc.)
  5. PHP is an open source software
  6. PHP is free to download and use
  7. PHP files can contain text, HTML tags and scripts
  8. PHP files are returned to the browser as plain HTML 
  9. PHP files have a file extension of “.php”, “.php3”, or “.phtml”
  10. PHP programs start with “” tag. e.g:
  11. HTML can be written inside a PHP code block just like JSP and Servlets in Java
  12. PHP runs on different platforms (Windows, Linux, Unix, etc.)
  13. PHP is compatible with almost all servers e.g. apache, IIS, etc.
  14. PHP official website is:
  15. PHP is easy to learn and runs efficiently on the server side

How to start with PHP?
1. Download and Install WAMP SERVER. Click here to download.
2. Create and store your php files in the www directory of installed wamp server which can be generally found in c:// drive or in the drive where you have installed the wamp server.
3. Start the wamp server
4. Click on the tray icon of wamp server and after the pop up menu appears click on the localhost option.< 5. Locate your folder under heading "your projects" and thats it. 6. Your Program is running now. Example Program 1:

1. save this file as index.php
2. put the file index.php in a folder name first
3. now move the folder to www directory of wamp server
4. start the wamp server
5. click on the tray icon of wamp server
6. click on localhost from the pop appeared
7. click on the folder “first” listed under heading “your projects”
8. You can see the output now.
Output of index.php : Hello World in PHP!Hello World!
echo is used for printing or displaying data in php we can use ‘Hello World!’ (single quotes) or “Hello World” (double quotes).

Example2 : variable.php

Perform the same steps as above to run.

In PHP there are no primitives like in java. Every variable starts with $ sign and can hold any type of value the PHP handles it implicitly to find out the type of value the variable is holding and by default it is considered as a string.

Installation of PHP + Apache

In this post i am going to describe the procedure of installation of PHP and Apache on your own computer.

Step-1 Download PHP , I am using “”

Step-2 Download Apache, I am using “httpd-2.0.64-win32-x86-no_ssl.msi”

Step-3 Once you download , first install Apache server
           write localhost in the first two fields and put any email id in the last field.
           If you want Apache to automatically start with the operating system, which is recommended, then
          choose to install Apache as a service for all users. When you’re finished, click Next.
          You are prompted for a Setup Type: Typical or Custom. choose Typical and click Next

          Destination folder. By default, this is C:\Program Files\Apache Group. Consider changing this
          to C:\,which will create an installation directory C:\Apache2\. Now click install to complete the installation

Step-4 Unzip the PHP package, placing the contents into C:\php5\.

Step-5 Now add PHP installation directory path to the Windows Path.
           for this click start > settings > control panel > system > click on advanced tab click the
           Environment Variables button. In the Environment Variables dialog box, scroll through
           the System variables pane until you find Path. Double-click this line and, in the Edit
           System Variable dialog box, append C:\php5 to the path.

Step-6 Navigate to C:\apache2\conf and open httpd.conf for editing.

Step-7 Add the following three lines to the httpd.conf file. Consider adding them directly
           below the block of LoadModule entries located in the bottom of the Global Environment section.

Step-8 Rename the php.ini-dist file php.ini and save it to the C:\php5 directory.

step-9 navigate to Start > Settings > Control Panel > Administrative Tools > Services.
          Locate Apache in the list, and make sure that it is started. if already started then click on restart.

Testing Your Installation
The best way to verify your PHP installation is by attempting to execute a PHP script. Open a
text editor and add the following lines to a new file. Then save that file within Apache’s htdocs
directory as phpinfo.php:
Now open a browser and access this file by typing the appropriate URL:

now you can start coding in php .ENJOY!