On Wed, 12 Apr 2006 10:19:32 +0100 Chris Smith <chris@xxxxxxxxxxxxx> wrote: > Andreas Gohr wrote: > > ------------------------------------------------------------------- > > -- Tue Apr 11 20:27:21 CEST 2006 Andreas Gohr > > <andi[at]splitbrain.org> > > * releaxed header syntax > > ------------------------------------------------------------------- > > -- > What is the status of the header changes after this last patch? I just discovered a much simpler and faster method: strspn() The code now boils down to: $level = 7 - strspn($match,'='); if($level < 1) $level = 1; $title = trim($match,'= '); I just did some profiling for 5000 parsed headlines: Your method using preg_split and strlen: Time Taken Number of Calls Function Name 0.0336592736 5000 preg_split() 0.0049825367 5000 strlen() Using just strspn: Time Taken Number of Calls Function Name 0.0066876130 5000 strspn() I didn't bother to test my old method using the lookup array, it was probably much much slower than both of the above. Andi