Friday, February 27, 2015

PHP For beginers

PHP learning Part-1

What is PHP?

PHP: Hypertext Preprocessor.
PHP is used as an Open source scripting language.
PHP script can execute on the server (apache).

Why PHP?



To make your webpage dynamic PHP is very important. Its used in wordpress. A dynamic webpage can use and handle very easily. And a PHP site is secured than others.

What is a PHP file?

 PHP file have access of text, HTML, CSS, Javascript and PHP code. PHP files must should be ".php" as an extension. Like - login.php, index.php, form.php, etc.

PHP Syntax

PHP script can be placed anywhere in the document, it can used in the "head", "body","title","angchor tag", anywhere.

The PHP starting syntax is
The PHP syntax ends with (?>). 

That means the PHP syntax is 

Comments system in PHP

There are mainly three (3) comment systems in PHP. These are-
  • Single line comment {start with double slash ( // )}. or,
  • Single line comment { can start with a hash ( # )} and
  • Multiple lines comments { Its start with single slash and star sign (/*) and ends with a star and a slash (*/), like this- /* ........here will be the comments......*/}.

Case sensitivity of PHP

There are some keywords, classes and functions in PHP.  Keywords are ( if, else, while, echo, print, etc.), these all are not case sensitive in PHP. But all variable names are case sensitive. So, you should be careful about this. Otherwise it can provide you wrong output.


PHP variables

A varible must starts with the $ sign in PHP. Like- ($text, $x, $y, etc.)

A text value of a varible must rounded by quotes. Like this- ($text="This is a text value of variable";).

You must should start a variable name with a letter or  with an underscore character. Like this- ($x, $y, $_x, $_y, etc.).
But a variable name cannot start with a number. Like- ($9 , $6, etc.) Variable name contain only alpha-numeric characters and underscores. And remember that, variable names are always and must case sensitive.


                                                                                 ......................................... To be continue ...

Thanks

No comments: