...

View Full Version : sending data from one array to another



eon201
11-07-2007, 11:24 AM
Hi im trying to output some data from one array that has been looped through into another so i can do some further calculations. But I dont know which function to use... Can anyone help??



// calculate all page requests
$all_request = count($log_request); // calculate all page counts value

//calculate dirty page counts


foreach ($log_request as $temp)
{
$last = substr($temp, -3, 3);
if ($last == "gif" || $last == "jpg" || $last == "txt" || $last == "swf" || $last == "png" || $last == "css" || $last == "/^.js/" || $last == "ico"){
echo "i have found bad data $temp<br/>";// need to save this out to $badrequest
}
else {
echo " i have NOT found bad data $temp<br/>";
}

}
// calculate actual page count value
//$good_request = $all_request - $bad_request;

//echo "$good_request";



Thanks in advance!

shyam
11-07-2007, 03:19 PM
why do u need functions at all?


$all_request = count($log_request); // calculate all page counts value
$bad_request = 0;
foreach ($log_request as $temp) {
$last = substr($temp, -3, 3);
if ($last == "gif" || $last == "jpg" || $last == "txt" || $last == "swf" || $last == "png" || $last == "css" || $last == "/^.js/" || $last == "ico"){
echo "i have found bad data $temp<br/>";// need to save this out to $badrequest
$bad_request++;
}
}
$good_request = $all_request - $bad_request;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum