Directory Image
This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Privacy Policy.

What is PHP? A beginners guide to PHP - BYTES

Author: Tejaswini Teja
by Tejaswini Teja
Posted: Sep 07, 2017

PHP is mostly used server side scripting language which is designed for web development. It is also used as a general-purpose programming language. PHP originally stands for Personal Home Page but it now stands for the recursive acronym Hypertext Preprocessor. Rasmus Lerdorf created in 1994 and now the PHP reference implementation is produced by PHP Development Team. PHP code can either be embedded into HTML or HTML5 markup, or it can be used along with various web frameworks, web CMS (Content Management Systems), web template systems.

PHP code is processed by a PHP interpreted implemented as a module in the web server or as a CGI (Common Gateway Interface) executable. The web server software combines the results which are interpreted and executed PHP code, which may be any type of data, including images, with the generated web page. PHP code may also be executed with a command line interface (CLI) and can be used to implement standalone graphical applications.

Some features of PHP are given below:

  • It is open source and very simple.
  • It is faster than any other scripting language.
  • It is an interpreted language (no need of compilation).
  • PHP is platform independent i.e., code will run on every platform.

Basic PHP Syntax:

Steps for writing a PHP Syntax are as follows:

  • Create a blank file using any program that can save in plain text format.
  • Save your file name as a.PHP file. Saving a page with the.php extension tells your server it needs to execute the PHP code.
  • Enter the statement to let the server know that there is PHP code coming up.
  • After this, we should enter the body of PHP program.
  • At last enter?> to let the browser know that the PHP code is done.

Each and Every section of PHP code starts and ends by turning on and off PHP tags, to make the server know that it needs to execute the PHP code in between them. Here is an example:

//on

//and

//off?>

Everything in between these tags is read as PHP Code.Anything outside of these PHP tags is treated as HTML Code.So,you can easily switch between PHP and HTML as needed.

Comments:

If you want to make a note to yourself of what the code is about for reference to edit it later, you can use Comments.

Some ways for creating comments in PHP are as follows:

//A comment on a single line

#Another type of comment on a single line

/*Multiple line comment */

Print and Echo statements:

Print and echo are two basic ways to get output in PHP. Both are almost the same, the difference is ECHO is slightly faster than PRINT.

Example:

echo "It is PHP code"

print "It is PHP code"

Variables:

A variable is something that represents another value. In PHP, a variable starts with the $ sign, followed by the name of the variable.

For example:

  • x=5
  • txt ="Hello World!"

You can learn complete PHP from Bytes Online Training with real time experienced trainers. Training in your flexible timings,24*7 support team, trainers with minimum 3 years of real time experience in the industry. Bytes Online Training provides FREE Live Demo for everyone. Register here for FREE Live Demo:

https://goo.gl/EwGPCi.

For more details about Bytes PHP Online Training:

Call Us: USA: +1 732-593-8450

India: +91 998-952-7180

Mail Id: info@bytesonlinetraining.com

Website: http://www.bytesonlinetraining.com/product/php-online-training/

Rate this Article
Leave a Comment
Author Thumbnail
I Agree:
Comment 
Pictures
Author: Tejaswini Teja

Tejaswini Teja

Member since: Aug 07, 2017
Published articles: 5

Related Articles