2

I'm trying to comment out the snippet between ~/**********/~ in the below code inside of a php function:

       $photobody[]="<tr><td colspan=\"".$cols."\">
        <table width=\"100%\" border=\"0\">
        <tr><td width=\"33%\">
        <div align=\"left\" class=\"caption\">".$prev."</div></td>
        <td width=\"33%\">                         
    ~/***** <div align=\"center\" class=\"caption\">Photos 
        <strong>".($photonum-(($rows*$cols)-1))."</strong> to 
        <strong>".$endnum."</strong> of 
        <strong>".count($photos)."</strong>
    <br />".$photopage."</div> ****/~ 
        </td><td width=\"33%\">
        <div align=\"right\" class=\"caption\">".$next."</div></td></tr></table></td></tr>";

Having some difficulty. Is there something that I need to escape to get that section to comment out? Little help. Thanks.

testing123
  • 761
  • 6
  • 13
  • 37
  • http://stackoverflow.com/questions/2713710/comment-associative-array-in-php-documentor here you can get some help – Ayush Dixit Jan 16 '16 at 06:22

3 Answers3

2

The section you want to comment is of pure HTML type. Thus you need to put HTML comment as shown:-

$photobody[]="<tr><td colspan=\"".$cols."\">
    <table width=\"100%\" border=\"0\">
    <tr><td width=\"33%\">
    <div align=\"left\" class=\"caption\">".$prev."</div></td>
    <td width=\"33%\">                         
<!-- <div align=\"center\" class=\"caption\">Photos 
    <strong>".($photonum-(($rows*$cols)-1))."</strong> to 
    <strong>".$endnum."</strong> of 
    <strong>".count($photos)."</strong>
<br />".$photopage."</div> --> 
    </td><td width=\"33%\">
    <div align=\"right\" class=\"caption\">".$next."</div></td></tr></table></td></tr>";
Maharshi Roy
  • 358
  • 2
  • 11
1

For commenting used <!-- -->

$photobody[]="<tr><td colspan=\"".$cols."\">
        <table width=\"100%\" border=\"0\">
        <tr><td width=\"33%\">
        <div align=\"left\" class=\"caption\">".$prev."</div></td>
        <td width=\"33%\">                         
  <!--<div align=\"center\" class=\"caption\">Photos 
        <strong>".($photonum-(($rows*$cols)-1))."</strong> to 
        <strong>".$endnum."</strong> of 
        <strong>".count($photos)."</strong>
    <br />".$photopage."</div> -->
        </td><td width=\"33%\">
        <div align=\"right\" class=\"caption\">".$next."</div></td></tr></table></td></tr
Wasiq Muhammad
  • 3,080
  • 3
  • 16
  • 29
0

You should close the previous string with an extra " in order for the text after /* to be a comment:

    "<td width=\"33%\">"                         
    /***** <div align=\"center\" class=\"caption\">Photos 
    <strong>".($photonum-(($rows*$cols)-1))."</strong> to 
    <strong>".$endnum."</strong> of 
    <strong>".count($photos)."</strong>
<br />".$photopage."</div> ****/
    "</td><td width=\"33%\">"
Assem
  • 11,574
  • 5
  • 59
  • 97