Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[HOWTO] Check memory usage and loading time
#5
Thanks guys....
Just something I forgot to put in it.

PHP Code:
function parseHTML($str)
{
    
$data exec_weight();
    
$str file_get_contents($str);
    
$str htmlentities($strENT_QUOTES);
    
$data exec_weight($data[0], $data[1]);
    return 
$data;
}
// Should BE
function parseHTML(&$str)
{
    
$data exec_weight();
    
$str file_get_contents($str);
    
$str htmlentities($strENT_QUOTES);
    
$data exec_weight($data[0], $data[1]);
    return 
$data;


Notice the & in the changed version, parseHTML(&$str)
This is called Passing by Reference, it simply means that the variable passed to the function, will be updated by the function, no need for returning changed content.
Since the function parseHTML only returns memory usage and execution time, changes to $str don't really happen, since we are not getting them back or outputing them in any way.
Reply


Messages In This Thread
RE: [HOWTO] Check memory usage and loading time - by Gaijin - 03-05-2011, 10:58 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Memory leak hrs 1 521 05-05-2011, 03:50 PM
Last Post: Gaijin

Forum Jump:


Users browsing this thread: 2 Guest(s)