Reputation: 3039
I need to comment some lines of code that already contain other comments,
I tried to do something like this:
...
<?php /* ?>
<ul>
<li></li>
<li></li>
<li></li>
<?php /* ?>
<li></li>
<li></li>
<?php */ ?>
<li></li>
<li></li>
<li></li>
</ul>
<?php */ ?>
...
but it does not work. How can I do it?
Upvotes: 2
Views: 919
Reputation: 6020
No you can't use multi-line php comment nested. Multi-line comment starts at the first
Upvotes: 0
Reputation: 26
Unfortunately you cannot. However, depending on what your code is actually doing, you may be able to get away with commenting out the HTML outputted by the php. Like this:
<!--
<ul>
<li></li>
<li></li>
<li></li>
<?php /* ?>
<li></li>
<li></li>
<?php */ ?>
<li></li>
<li></li>
<li></li>
</ul>
-->
Upvotes: 0
Reputation: 369
From the PHP documents: http://php.net/manual/en/language.basic-syntax.comments.php
'C' style comments end at the first */ encountered. Make sure you don't nest 'C' style comments. It is easy to make this mistake if you are trying to comment out a large block of code.
So you cannot nest multi-lined comments.
Upvotes: 3