Results 1 to 3 of 3

Thread: file getting written wrongly

  1. #1
    Join Date
    Jan 2009

    Exclamation file getting written wrongly

    I use a simple file counter to track how many times each function
    in a script of mine gets executed. so I have two file
    to track how many times each function is called/executed.
    The script is written is such a way that
    one function will be executed once only
    after the other function is executed
    atleast three times.(after page receives 3 hits)
    So content of one file will be always higher than the other file.
    But sometimes the content of the second file
    is more than the other file
    What might be the problem ?

    Is there any other way to track how many times a function is called ?

  2. #2
    Join Date
    Jan 2009
    Can you post some code? It sounds like a logic error to me.

  3. #3
    Join Date
    Aug 2004
    As far as tracking function usage, I might do:
    PHP Code:
    $GLOBALS['function_count'][__FUNCTION__]) ? 
    $GLOBALS['function_count'][__FUNCTION__]) + 1;
    // rest of function definition . . .
    // end of script:
    $log __FILE__ " (" date('Y-m-d H:i:s') . "): ";
    $GLOBALS['function_count'] as $function => $count)
    $log .= $function $count "; ";
    error_log(rtrim($log" ;")); 
    Then just check the PHP error log for usage (or specify a separate file in the call to error_log()).
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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

Recent Articles