Google News
logo
PHP Getting Started

PHP  Installation

To install PHP, we will suggest you to install AMP (Apache, MySQL, PHP) software stack.  It is available for all operating systems.  They are following softwares : 

1. WAMP  : Windows(O S) Apache MySQL PHP
2. LAMP :  Linux (O S) Apache MySQL PHP
3. MAMP : Mac(O S) Apache MySQL PHP
4. XAMPP : X (Cross O S) Apache MySQL PHP Perl - It includes some other components such as FileZilla, Mercury , Tomcat.

Download and Install WAMP Server


Download and Install LAMP Server


Download and Install MAMP Server


Download and Install XAMPP Server

Basic PHP Syntax
A PHP script starts with <?php and ends with ?> :

<?php
    //Some Content
?>

PHP files have extension ".php".

Example : ( first-program.php )
<!DOCTYPE html>
<html>
<head>
<title>PHP Syntax</title>
</head>

<body>

<h3>This is my First Program</h3>
<?php 
   echo " Welcome to Free Time Learning. ";
?>
    
</body>
</html>
Every PHP statement end with a semicolon (;) : That means end of the current statement.
Output :
PHP Comments
A comment in PHP code is a line that is not read/executed as part of the program. The purpose of comments is to make the code more readable. It may help other developer (or you in the future when you edit the source code) to understand what you were trying to do with the PHP.
Single line comments
To write a single-line comment either start the line with either two slashes (//) or a hash symbol (#). Like following example :
<!DOCTYPE html>
<html>
<head>
<title>PHP Single Line Comments</title>
</head>
<body>

<?php
   // Single Line Comments
   # Single Line Comments
   echo "<h2>FTL (www.freetimelearning.com)</h2>";
?>
    
</body>
</html>
Output :
Multi Line Comments
multi-line comments, start the comment with a slash followed by an asterisk (/*) and end the comment with an asterisk followed by a slash (*/). Like following example :
<!DOCTYPE html>
<html>
<head>
<title>PHP Multi Line Comments</title>
</head>
<body>

<?php
   /*
    <h4>multi line comments</h4>
    <h5>multi line comments</h5>
    <h6>multi line comments</h6>
   */
   echo "<h2>FTL (www.freetimelearning.com)</h2>";
?>
    
</body>
</html>
Output :
PHP Case Sensitivity
In PHP, all keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are NOT case-sensitive. Like following example :
<!DOCTYPE html>
<html>
<head>
<title>PHP Case Sensitivity</title>
</head>

<body>

<h4>PHP Case Sensitivity</h4>
<?php
ECHO "Free Time Learning.<br>";
echo "Free Time Learning.<br>";
EcHo "Free Time Learning.<br>";
?> 
    
</body>
</html>
Output :

PHP is a case-sensitive programming language. Try out the following example :

<!DOCTYPE html>
<html>
<head>
<title>PHP Case Sensitivity</title>
</head>
<body>

<h4>PHP Case Sensitivity</h4>
<?php
$ftl = "www.freetimelearning.com";
echo "My Website is : " . $ftl . "<br><br>";
echo "My Website is : " . $fTl . "<br><br>";
echo "My Website is : " . $FTL;
?>
    
</body>
</html>
Output :