|
Posted by Rik on 02/14/07 02:15
On Wed, 14 Feb 2007 02:12:32 +0100, Generale Cluster =
<alex@carrarosoftmasters.net> wrote:
> Jerry Stuckle ha scritto:
>> Generale Cluster wrote:
>>> Jerry Stuckle ha scritto:
>>>> Rik wrote:
>>>>> Generale Cluster <alex@carrarosoftmasters.net> wrote:
> [CUT]
>> That's the difference. I prefer code which is easily understandable=
..
>> You had trouble getting it to work in the first place. What happens=
=
>> when you have to look at it six months or a year from now when you ha=
ve =
>> to work on it again? You'll go through all of his again to understan=
d =
>> what it does.
> [CUT]
>
> comment, comment, comment and comment again :-)
Commenting in the single line?
Just tell them to leave everything between <?php ?> alone and it should=
=
be OK, no reason to forced single line statements. About that, if you're=
=
worried about that, then why not just code it on the single line on norm=
al =
code? Linebreaks aren't actually required in PHP, so you could just leav=
e =
them in, and when the code needs to be updated you can whip it into some=
=
kind of formatted readable shape quite fast with any competent textedito=
r.
But the main reason for me posting here in this thread is about =
commenting: I'd like to take the oppertunity advocate the user of the /x=
=
modifier for regexes. These pesky little things are often forgotten in t=
he =
commenting, while it's so easy.
Compare (not a very useful regex, just an illustration):
$regex =3D '/(a|b){2,4}([^\s]+?)c{2,4}(.*?)q/si'
And
$regex =3D '/{a|b}{2,4} #start matching at 2 to 4 a's or b's in a row
([^\s]+?) #capture all non whitespace untill the next match
c{2,4} #match 2 to 4 c's
(.*?) #capture any character
q #until q
/six'; //case-insensite, with comments
Now, that will be a lot easier altered and understood by coworkers I'd =
imagine..
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|