QuietRiot Posted April 6, 2010 Share Posted April 6, 2010 I've been struggling with this for awhile now. How do I get the contents of the array to actually display. I keep getting "Array". if ( preg_match_all("#<td class=\"alt1\"><div class=#i", $html, $matches) ) { $res = array(); array_push($res,$matches[0]); array_push($res,count($matches[0])); echo $res[0]; } Link to comment https://forums.phpfreaks.com/topic/197793-preg_match_all-to-array-help/ Share on other sites More sharing options...
Chris92 Posted April 6, 2010 Share Posted April 6, 2010 print_r($res[0]); if ( preg_match_all("#<td class=\"alt1\"><div class=#i", $html, $matches) ) { $res = array(); array_push($res,$matches[0]); array_push($res,count($matches[0])); print_r($res[0]); } Link to comment https://forums.phpfreaks.com/topic/197793-preg_match_all-to-array-help/#findComment-1037983 Share on other sites More sharing options...
QuietRiot Posted April 7, 2010 Author Share Posted April 7, 2010 thank you. If I wanted to do a preg_match_all against those results how would I go about doing that? I want to get the actual names now and they are between <b>name1</b>: if ( preg_match_all("/<td class=\"alt1\"><div class=\"smallfont\"*>(.*)<\/td>/Ui", $html, $matches) ) { $res = array(); array_push($res,$matches[0]); array_push($res,count($matches[0])); print_r($res[0]); preg_match_all("/<b*>(.*)<\/b>/Ui", $res[0], $bolds); $names = array(); array_push($names,$bolds[0]); array_push($names,count($bolds[0])); print_r($names[0]); } Link to comment https://forums.phpfreaks.com/topic/197793-preg_match_all-to-array-help/#findComment-1038075 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.