Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php .com


In php there are 3 types of comments
1.single line c++ style comment(//)
2.single line Unix shell stype comment(#)
3.multi line c style comment(/*/)

single or multi line comment comes to the end of the line or come first to the current block of php code.

HTML code will be printed after //...?> or #...?>
closing tag breaks the php mode and return to html mode.

different comments in different tags:
===================================
 <H1>Standard tag: <?php //echo " standard tag"; ?>single line c++ style comment</H1>
 <p>The header above will break php mode and return html mode and show  'Standard tag:single line c++ style comment'</p>

 <H1>Standard tag: <?php # echo " standard tag"; ?>single line unix shell style comment</H1>
 <p>The header above will break php mode and return html mode and show  'Standard tag:single line unix shell style comment'</p>

 <H1>Standard tag: <?php /*echo " standard tag"; */?>multi line c style comment</H1>
 <p>The header above will break php mode and return html mode and show  'Standard tag:multi line c style comment'</p>

  <H1>short echo tag: <?= // " short echo tag"; ?>single line c++ style comment</H1>
 <p>The header above will break php mode show a unexpected syntex error'</p>

  <H1>short echo tag: <?= #  " short echo tag"; ?>single line c++ style comment</H1>
 <p>The header above will break php mode show a unexpected syntex error'</p>

  <H1>short echo tag: <?= /*echo " short echo tag"*/ ; ?>multiple  line c style comment</H1>
 <p>The header above will break php mode show a unexpected syntex error'</p>

 <H1>Short tag: <? //echo " short tag";?>single line c++ style comment</H1>
 <p>The header above will break php mode and return html mode and show  'Short tag:single line c++ style comment'</p>

  <H1>Short tag: <? #echo " short tag";?>single line unix shell style comment</H1>
 <p>The header above will break php mode and return html mode and show  'Short tag:single line unix shell style comment'</p>

   <H1>Short tag: <? /* echo " short tag";*/?>multi line c style comment</H1>
 <p>The header above will break php mode and return html mode and show  'Short tag:multi line c style comment'</p>

    <H1>Script tag: <script language="php"> // echo " script tag";</script>single line c++ style comment</H1>
 <p>The header above will break php mode and return html mode and show  'Script tag:single line c++ style comment'</p>

    <H1>Script tag: <script language="php"> /* echo " script tag";*/</script>multi line c style comment</H1>
 <p>The header above will break php mode and return html mode and show  'Script tag:multi line c style comment'</p>

    <H1>Script tag: <script language="php"> # echo " script tag";</script>single line unix shell style comment</H1>
 <p>The header above will not break php mode </p>
Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #php
ADD COMMENT
Topic
Name
8+5 =