Reply to [preg_match_all] Better algorithm?

Your name:

Reply:


Posted by Gilles Ganault on 06/12/07 18:37

Hello

I need to extract some bits of information from a web page, so
I used preg_match_all. I was wondering if there's a simpler algorithm,
or if that's the way it's done:

===========
preg_match_all("|$regex|smi",$buffer,$matches,PREG_PATTERN_ORDER);

$elements=sizeof($matches);
$x=sizeof($matches,TRUE);
$rows = $x/$elements;
$rows--; //Why is the last row empty?

print "elements=$elements, x=$x, $rows<br>";

for ($row=0;$row < $rows;$row++){
$string = "";
for($element=1;$element < $elements;$element++){
$string .= $matches[$element][$row] . ",";
}
//Remove trailing ","
$string = trim($string, ",");
print "$string<hr>";
}
===========

Thank you.

[Back to original 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

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