To start work with XAMPP you need to install it first. You can install it from application which gives you its exe file. It is easy to install different versions of XAMPP from it’s official website www.apachefriends.org. After downloading its latest version you need to install the file, after installing a file you will see the XAMPP control panel.
- You can see the different service list in control panel, for PHP programming we need to start apache server’s service which will help you on your local machine to execute PHP Scripting pages. Also it will send request from client browser to server or database.
You can watch how to download easily Tap here.
- After starting apache you will see the green background on apache service and also will display port number of Apache. It will change the status of apache with running.
- After this we need to start MySQL service. This service 1s used only when we want send some request for Database. This service will communicate with database with help of query string. This service is also coordinate with apache services. After start this service you will also found green background in MysQL service also will show e a port number. Status is change with running.
Xampp Server 2.0 :
PHP Syntax and Technics :
While we start to write PHP program first will start PHP mark- <?php also end with mark-up tag ?>,inside this opening and closing tag tag it’s our PHP syntaxes. Make sure while you open tag at that time we write PHP but a the time of closing no need to write PHP only use question mark and greater than sign. Basically PHP syntax is borrowed from ‘C programming language so it follows same rules of syntax. will ting language, means U language is also start with mark-up tag. We need to write mark-up tag of PHP before of writing syntax.
PHP Syntax Rules –
- We can place PHP syntax anywhere in document.
- The default file extension for PHP files is “.php”.
- PHP script starts with <?php and ends with ?>,
- PHP syntax are end with semicolon(;)
- All the core programming keywords (for example. If, else, for, while, echo etc.) functions, user function, classes are case-insensitive. Therefore the three echo statements in the following example are equal
<?php
Echo (“hello student”);
echo (“hello student”):
ECHO(hello student”):
?>
- Variables are case-sensitive. Therefore the three variables in the following example are different then each other all have different value and data type.
<?php
Sprice=10;
SPrice=30.50;
SPRICE-40;
echo(“The price=-Sprice”);
echo(“The price-SPrice”);
echo(The price=$PRICE”);
?>
- PHP whitespace is insensitive. means it will never matter how many number of you write in syntax or how many tabs you write in one row syntax also not read carriage-return (end of line characters). Therefore in bellow example it will not read space tab and new line. Between 2+2 it will do addition.
<?php
Sfour = 2 + 2; I/ single spaces
Sfour -2+ 2; / spaces and tabs
$four =
2+
2; // multiple lines
?>
PHP printing statement:
PHP has different printing statements. We can use following printing statements in PHP echo, print , printf() and print _r().
Note: we will discuss print r) function latter at the time of array.
1. Echo :
This function is used to print one or more statements.
•This function is faster than print function. Because it is not return any value.
• echo is not consider as a function so no need to write parentheses at the time of write echo statement.
• When you write any string message you need to write this message in double quotes.
• If you write to print any number or any variable than no need to write double quotes.
<?phpecho “hello World'”echo 123;echo Sno;
?>2. Print :
- This function is also same like echo.
- It is return value after function is call.
- It is little slower than echo
- Print is not considering as a function so no need to write parentheses at the time of write print statement.
- When you write any string message you necd to o write this message in” double quotes
- If you write to print any number or any variable than no need to write double quotes.
<?php
print “hello Asia”;
print 100;
3. Printf() :
- This function is used for formatted output.
- IT is used same like c programming printf) function.
- It is return value after function is call.
- Printf() is a function so parentheses are compulsory at the time of write printf0) statement.
- When vou use printf) function with variable then you have to define data type symbol with % sign as an argument of printf) function.
- We can use more mumber of argument in printf)
- After the argument complete we use coma () and write variable list in order of printing. parameter values are as follow
%f for floating point
%b binary value %e for scientific notation
%d integer
%s for string
%0 for octal
• %x for hexadecimal
PHP Comment :
Like C programming language it has two types of comments. One is Single line comment and second is Multiline comment. IT also use same character sets for comment, for single line comment we use two forward slash (() and also use Hash (#) sign. Any syntax are written with this sign are considering as single line comment it will not interpret by browser, it will ignore this syntax.
<?php
# echo “single line comment using Hash sing”;
For multiline comment it use forward slash and star (/*) and End with same order and forward slash (). In between any syntax is written are considering as multiline comment it will not interpret by browser, it will ignore this syntax.
<?php
/* echo “single line comment using forward slash”;
echo “single line comment using Hash sing”; */
What is PHP printing statement
PHP has different printing statements. We can use following printing statements in PHP echo, print , printf() and print _r().
Note: we will discuss print r) function latter at the time of array.
What is PHP Syntax Rules
- We can place PHP syntax anywhere in document.
- The default file extension for PHP files is “.php”.
- PHP script starts with <?php and ends with ?>,
- PHP syntax are end with semicolon(;)
Also watch New Topic