You are here: Re: Change alternate commas to semi colons... « PHP Programming Language « IT news, forums, messages
Re: Change alternate commas to semi colons...

Posted by Andy Jeffries on 06/21/06 18:32

On Wed, 21 Jun 2006 20:17:25 +0200, Juliette wrote:
> Oops.. I obviously posted too quickly (and yes, I didn't test the code
> before posting, just did it off-hand).

I tend to do the same thing, it's only because I have a particular
interest in optimising functions/code that I took an interest in this
thread.

> Interesting to see the ensuing discussion this has brought. I normally
> use preg myself, but just couldn't think of how to do this one. In that
> respect I still have a nice challenge (regex) I'm working on myself
> which I can't seem to get right.

That's a good point, I think Rik's regex is probably optimal (and indeed
that's the way I'd have done it) but is there a faster regex?

> Just in case someone is interested, you can find the corrected code from
> my function below. I've also gotten rid of some of the 'fluff' which I
> only put in to make the code easier to understand. About the extra
> delimiter: that was not explicite in the requirements given by the OP,
> so that's why I didn't take that into account. The below function does
> however deal with that correctly, i.e. the way you suggested it ought to
> work.

Cool, tested - result below :-)

> The regex will still win, but I would guess this is slightly faster than
> my earlier function.

Indeed it is, this function runs in 0.4208 seconds making it the second
fasted non-regex function.

Cheers,


Andy

--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

 

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

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