GetHow

Your How to Guide

  • Business
  • Career & Education
  • Entertainment
  • Health & Fitness
  • Internet
  • Technology
  • Tutorials

PHP Syntax

September 4, 2013 by Atul Kumar Pandey

A PHP script always begins with <?php and ends with ?> syntax. A PHP script can be placed anywhere in the document. On servers with shorthand support you can start a PHP script with <? And end with ?> syntax, but for maximum capabilities, we recommend that you use the standard form ( <?php … ?> ) rather than shorthand form ( <? … ?> ).

<?php
?>

A PHP file must have a .php extension. A PHP file normally contains HTML tags and some PHP scripting code. Below, we have an example of a simple PHP script that sends the text “Welcome to GetHow” back to the browser.

<html>
<body>

<?php
echo “Welcome to GetHow”;
?>

</body>
</html>

Note: Each line in the PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another.

There are two statements to output the text with PHP i.e. echo and print. In the above example we have used echo statement to output the text “Welcome to GetHow”.

Comments in PHP

In PHP, we use // to make a one line comment and for more than one lines we use /* at beginning and */ at end to make a comment block.

<html>
<body>

<?php

//This is a Statement for GetHow Site

/*
This is a
comment block
for more than one line
*/

?>

</body>
</html>

The above all are the basic syntax which are always used while writing a PHP script. We need to understand and practice it more so that, it gets stable on our fingers.

Filed Under: Tutorials

About Atul Kumar Pandey

I'm Atul Kumar Pandey, a full time blogger at GetHow by passion and founder of this blog by profession. I write what makes me feel worthy enough to share.

Business News

Promote Business

How to Promote Your Business?

The Quick Guide to Securing Your Real Estate Property

Restaurant

How to Promote Your Restaurant Business on a Budget?

Financial Freedom

Personal Priorities: How a Finance Degree Can Help You to Become a Master of Your Own Money?

Heath and Fitness

How to Improve Your Health Using Technology?

Health Insurance

How Health Insurance Can Help You Lead a Healthy and Stress-free Life?

Swine-Flue Test

How Swine-Flue Test is Clinically Conducted?

Addiction

How Addiction Affects Your Health

About Us | Advertise | Affiliate Disclosure | Privacy Policy | Write for Us


Handcrafted with by Atul

Powered by GetHow