I'm drowning in PHP

mirod mirod at xmltwig.com
Tue May 15 13:09:50 BST 2007


Andy Armstrong wrote:
> On 15 May 2007, at 12:12, graham wrote:
>> Jonathan Rockway wrote:
>>> On Monday 14 May 2007 10:12:31 pm Andy Armstrong wrote:
>>>> This is a small gem from some PHP I'm obliged to look at:
>>>>      for($i=0; $i<strlen($str); $i++) {
>>> Ah, the classic O(n^2) for loop.  Haven't seen that one for quite  
>>> a while, especially not in a language with built-in regexes.   
>>> Gotta love PHP...
>> In a case where n is never likely to be large enough for order  
>> notation to come into it.
> 
> That and the fact that it's not actually N^2 :)

Well, it is if strlen($str) is O(N), as it might well be in C for example.

-- 
mirod


More information about the london.pm mailing list