PHP Tutorials – Basic PHP Syntax

Basic PHP Syntax

Basic PHP Syntax – The basic PHP syntax is <?php (all code goes here) ?>. You may also consider the second basic PHP syntax as <? (all code goes here ?>, which is without the word “php”.

Example Program of Basic PHP Syntax:

<?php
  print "Basic PHP Syntax tutorial by RajasTutorials.com";
?>

Instead of print, you can also use echo, which is in fact mostly used for printing. Such as:

<?
  echo "Learn programming with RajasTutorials.com";
?>

But remember, the file must be saved as .php. You may use html code inside a php extension file, but you can’t use PHP code inside html extension file. So it’s always good to choose .php, even if you’re going to use only the html, as you may need PHP edition in the file in future.


“My posts/articles/images are not allowed to be stolen/copied anywhere at Cyber space. Doing so will allow me to take a legal action against the copier.”

Related Posts

M.Bakhtiar Zuberi
Hello, I'm M.Bakhtiar Zuberi, the only article poster & owner of this website. Your comments/suggestions are welcomed the most! RajasTutorials.com is a part of 3DPixelz.com network.

Leave a Comment

Kindly solve the following puzzle to prove that you\'re not a bot: