MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

PHP Programing language

PHP Syntax
Previous Home Next

Syntax in PHP

PHP's syntax and semantics are similar to most other programming languages (C, Java, Perl) with the addition that all PHP code is contained with a tag, of sorts.

A PHP script can be placed anywhere in the document. A PHP script starts with <?php and ends with ?>

Types of Php Syntax:

There are four different types of syntax or opening/closing tags used in php:
  1. Default Syntax
  2. Short Open Tags
  3. HTML Script Tags
  4. ASP Style Tags

Default Syntax: The default syntax starts with "<? php" and ends with "?>".

Example:

<?php  
echo "Default Syntax";  
?>  

 

Short Open Tags: The short tags starts with "<?" and ends with "?>". These tags are only used when they are enabled in php.ini configuration file on servers.

Example:

<?
echo "short tags";
?>

HTML Script Tags: Script is effective to solve escape situation which comes in some editors like Front Page editor

Example:

<script language="php">  
echo "HTML Script Tag.";  
</script> 

ASP Style Tags: The ASP style tags starts with "<%" and ends with "%>". It mimic the tags used by Active Server Pages to delineate code blocks. ASP style tags are only available when they are enabled via the asp_tags php.ini configuration file directive.

Example:

<% 
echo 'This is ASP like style';
%>
Combination of PHP and HTML

PHP syntax is only used within PHP tags. It is also embedded in HTML and it can be used anywhere in the document.

Example:

<html>
<head>
<title> PHP Page</title>
</head>
<body>
<?php
echo "This is php page...";
?> 
</body>
</html>

Output:

This is php page...
Previous Home Next