You are here: Re: create array from members of an array of objects « PHP Programming Language « IT news, forums, messages
Re: create array from members of an array of objects

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация