Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation sending data from one array to another

    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??

    PHP Code:
                    // 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, -33);
                        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!

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    why do u need functions at all?

    PHP Code:
    $all_request count($log_request); // calculate all page counts value
    $bad_request 0;
    foreach (
    $log_request as $temp) {
      
    $last substr($temp, -33);
      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
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •