Ok, I'm using preg_match_all to find occurences of strings within some text and then concatenating them together and converting them to float. The weirdest thing though is directly after concatenating them, echoing strlen shows that the length is 61 when it is clearly only five. Can anyone help? thanks
Here is the code around that section:
btw, the error is that when i try to convert it to float, it returns 0 everytime
foreach($matches[1] as $key => $value)
{
$results = curl("http://www.argos.co.uk/webapp/wcs/stores/servlet/ArgosBrowseCounts?storeId=10001&catalogId=3151&langId=-1&categoryId=".$value."&perPage=10000");
preg_match_all("/\<tr\>\<td class\=\"bgMidShade\" align\=\"center\"\>\<a href\=\"(.*?)\" class\=\"productLink\"\>\<img src\=\"(.*?)\" width\=\"110\" height\=\"110\" alt\=\".*?\" border\=\"0\" vspace\=\"1\" hspace\=\"1\"\>\<\/a\>\<\/td\>\<\/tr\>/i", $results, $matches1);
preg_match_all("/\<td valign\=top class\=productPriceLister rowspan\=2\>(.*?)\<\/td\>/i", $results, $big_prices);
preg_match_all("/\<td valign\=top class\=productPriceSmall\>(.*?)\<\/td\>/i", $results, $small_prices);
preg_match_all("/class\=\"productLink\"\>(.*?)\<\/a\>\ \;/i", $results, $names);
$sPtr = 1;
for($i = 0; $i < count($matches1[1]); $i++)
{
$image = addslashes("http://www.argos.co.uk".$matches1[2][$i]);
$link = addslashes("http://www.argos.co.uk/webapp/wcs/stores/servlet/".$matches1[1][$i]);
$small_prices[1][$sPtr] = substr($small_prices[1][$sPtr], 0, 3);
$big_prices[0][$i] = substr($big_prices[0][$i], 0, strlen($big_prices[0][$i]));
$str = "".$big_prices[0][$i].$small_prices[1][$sPtr];
print($str);
print(strlen($str));
$price = strtflt($str);
$name = addslashes($names[1][$i]);
print($link."<br>");
print($image."<br>");
print($name."<br>");
print($price."<br>");
/*
$sql = "INSERT INTO uploads(name, price, url, category, merchant_id, status) VALUES('$name', '$price', '$link', '0', '226', '1')";
mysql_query($sql) or die(mysql_error());
$id = mysql_insert_id();
copy($image, "ico/$id.gif");
*/
$sPtr += 2;
}
}