Introduction
PHP is a powerful tool for making dynamic and interactive Web pages.
It is the widely-used, free, and efficient alternative to competitors such as Microsoft's ASP and other scripting languages.
In our tutorial you will learn about PHP, and how to execute scripts on your server.
XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start.
What is PHP?
- PHP stands for PHP: Hypertext Preprocessor
- PHP is a server-side scripting language, like Ruby on Rails, ASP, JSP and others
- PHP scripts are executed on the server
- PHP is an open source software
- PHP supports many databases (MySQL, Oracle, PostgreSQL and etc.)
- PHP is free to download and use
- PHP files have a file extension of ".php" or ".php3"
- PHP runs on different platforms (Windows, Linux, Unix, etc.)
- PHP is compatible with almost all servers used today (Apache, IIS, etc.)
- PHP is FREE to download at www.php.net
- PHP is easy to learn and runs efficiently on the server side
- Any Text Editor like Notepad, Notepad++ and E
- Download XAMPP for Windows at http://www.apachefriends.org/en/xampp-windows.html then install it just follow the installation wizard.
How to Run a PHP file using XAMPP?
- Create a PHP file then save it to C:\xampp\htdocs directory.
- Open your browser then type "http://localhost/Your PHP File name" or "http://I.P. Address/Your PHP File name"
Basic PHP Syntax
A PHP scripting block always starts with <?php and ends with ?>. A PHP scripting block can be placed anywhere in the document.
Example:
<?php
//Put your code here
?>
//Put your code here
?>
A PHP file normally contains HTML tags, Javascript and PHP scripting code.
Example:
<html>
<body>
<?php
echo " Hello World ";
?>
</body>
</html>
<body>
<?php
echo " Hello World ";
?>
</body>
</html>
Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another.
Note: The file must have a .php or .php3 extension else the PHP code will not be executed.
Comments in PHP
- // to make a single-line comment
- /* and */ to make a large comment block.
<html>
<body>
<?php
//This is a comment
/*
This is
a comment
block
*/
?>
</body>
</html>
<body>
<?php
//This is a comment
/*
This is
a comment
block
*/
?>
</body>
</html>
Variable Declarations in PHP
Variables are used for storing a values, like text strings, numbers or arrays.
In PHP, a variable does not need to be declared before adding a value to it and no data type needed, PHP will automatically converts the variable to the correct data type, depending on its value.
PHP variables are start with a $ sign symbol.
Example:
$variable_name = value;
Naming Rules for PHP Variables
- A variable name must start with a letter or an underscore "_"
- A variable name should not contain spaces.
- A variable name can only contain alpha-numeric characters and underscores (a-z, A-Z, 0-9, and _ )
$variable_name
$VariableName
$varName
$varName1
$VariableName
$varName
$varName1
Nice page, ill send you some visitors and give you a dig. I proof sites for quad hits and seen this and liked it. Very nicely put together
ReplyDeletethanks For Information
ReplyDeleteThanks a lot I was looking for some initial info.
ReplyDeletethanks a lot. I was bit confuse with local host setting and PHP setting. but with this information , i am all clear.. thanks a lot again...
ReplyDeletenice page.... i learn a lot.... thanks
ReplyDeleteThanks for visiting my blogs.
ReplyDeleteGood stuff, your blog came among the first for 'php tutorial on xampp' (without the '') which is exactly what I was looking for. I like that information is organised with bullets, that makes it all much clearer. Thanks
ReplyDeleteIt thought PHP stood for Personal Home Pages
ReplyDeletea beneficial info..
ReplyDeletethanks:)
In using PHP programming I use WAMP but i plan to migrate to Ubuntu to use LAMP. BTW Nice tutorial :)
ReplyDeletethis good for php
ReplyDeletethanks bose to help me
ReplyDeletei want 2 get lots of example on php programing
ReplyDeletehi good post for php beginners like me.
ReplyDeleteThanks a lot.
Cegonsoft
NICE PAGE. ALL REQUIRE KNOWLEDGE IN A PAGE
ReplyDeleteThanks for all your comments... This is for basics... but i have a plan to do advance if i have vacant time.
ReplyDeleteWas really helpful...less help is available for such topics
ReplyDeletethanks nice basics about xampp and php
ReplyDeleteVery useful, had no idea where to start....
ReplyDeleteGood Page for beginner
ReplyDeletegood php basic focussed
ReplyDeleteThank you for sharing this info .. Very useful tips. Xampp is a great way to get started with php ...
ReplyDeleteU Make my day...brief & clear, Keep it up!!
ReplyDeletethanks for your post
ReplyDeletesecawan webserver vs XAMPP
ReplyDeletewatch here
/watch?v=0dFOE7K55Ss
freshly installalled and can't wait to get querty monotonous and all, and all,and all,and all echo?
ReplyDeleteExcellent php tutorials. Nice php code.
ReplyDeletePHP Development Company
thanks its useful for me
ReplyDeletethanks for providing basics....as I am beginner in programming..your tutorial helped a lot...
ReplyDeleteregards
venkat
hyderabad,india
very good overview
ReplyDeleteHi friends ,
ReplyDeleteI am new in Php , and i make a php project its running well from localhost but i want to run it by ip address -
like http://xxx.xx.xxx.xx/8080/first.php
http://localhost/8080/first.php in this way its running well
please help me
Thanks in andvanced
great information you have shared
ReplyDeleteWebsite Development company
thanks a lot
ReplyDelete