Re[2]: [PHP] Divide into words

2002-12-16 Thread Uros Gruber
Hi! I have dome almost the same $input = 'Today is a very beautiful day and the sun is shining'; $output = array(); $words = explode(' ',$input); $cur_pos = 0; foreach($words as $word) { if(!empty($output[$word])){ $output[$word] .= ','.$cur_pos; } else { $output[$word]

Re: Re[2]: [PHP] Divide into words

2002-12-16 Thread Marco Tabini
Yes, but my example was geared towards trying to work through a more generic scenario. I'll bet if you try using perl regex with callback it'll be even faster. Marco -- php|architect - The magazine for PHP Professionals The monthly worldwide magazine dedicated to PHP programmers

Re: Re[2]: [PHP] Divide into words

2002-12-16 Thread 1LT John W. Holmes
Yes, but my example was geared towards trying to work through a more generic scenario. I'll bet if you try using perl regex with callback it'll be even faster. I'll take that bet and say using preg_*_callback will be slower. :) I'll try and time each of them tonite and post what I find.