Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1099439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:44:12+00:00 2026-05-17T00:44:12+00:00

I’ve got an applicaiton with various php scripts. I want to get an idea

  • 0

I’ve got an applicaiton with various php scripts. I want to get an idea of how much time it takes for the execution to move from one point to another (there are many such points).

I was looking for a simple php line that I can insert without modification, at different spots in my code and get an output file (NOT generated html) which shows something like:

FILENAME      FUNCTION        LINENUMBER      TIMESTAMP

I’ve started using this:

file_put_contents('/home/default/public_html/debug.log',  __FILE__ . "\t" .
 __FUNCTION__ . "\t" . __LINE__ . "\t" . microtime(true)."\n", FILE_APPEND);

which is good, but are there better ways of doing the same?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:44:13+00:00Added an answer on May 17, 2026 at 12:44 am

    For a simple way to do this, you can either use the global PHP error system with trigger_error() and a E_NOTICE level, or the error_log() function to log in a separate file.

    I your case I would recommend the second solution.


    With the trigger_error():

    <?php
        trigger_error("Call will start now", E_NOTICE);
        startTheHugeCall();
        trigger_error("Call is finished", E_NOTICE);
    ?>
    

    With the error_log() :

    <?php
        error_log("Call will start now", 3, "/var/tmp/debugfile.log");
        startTheHugeCall();
        error_log("Call is finished", 3, "/var/tmp/debugfile.log");
    ?>
    

    Resources :

    • php.net – trigger_error()
    • php.net – Error handling, Predefined Constants
    • php.net – error_log()
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.