5

Is there a comment tag in which I can enclose a section (of php code) which the auto formatter will ignore?

Sometimes I use a unique indention style for a tricky section of php code. For example if I pass several arrays i initialize in-line. It is sometimes the only way to keep things readable. Unfortunately this is lost after applying the code formatter.

T30
  • 11,422
  • 7
  • 53
  • 57
Johan van den Broek
  • 384
  • 2
  • 5
  • 18
  • There is no universal solution that would work for every code formatter. The answer depends on which one you're using, however, 'not possible' is likely the answer. – Zr40 Apr 06 '11 at 22:34
  • I'm not sure what you mean by which code formatter. I use the integrated php code formatter that ships with Netbeans 7 RC1 php distro. Could be I'm looking a feature that's not there (yet). – Johan van den Broek Apr 11 '11 at 22:37
  • Please provide a sample of code formatted by auto-formatter and the same code formatted like you want. – T30 Jul 27 '15 at 10:04

1 Answers1

0

Some ways you may comment code:

// comment out a single line

You can also use a shell style comment in the middle of code like,

<h1>This is an <?php # echo 'simple';?> example</h1>

The header above will say 'This is an example'.

Then finally you can do multi line comments like,

/* line one
line two and
line three are commented */
TimD
  • 462
  • 6
  • 18