CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2006
    Posts
    306

    Javascript-Like Time Function

    How do I get a javascript-like output in seconds, from PHP? I want to track the amount of time it takes to pass all the data from server to client.

    Consider this code.
    Code:
    var Now = new Date().getTime();
    document.write(new Date().getTime() - Now);
    I want it like this.
    Code:
    <script>
        <?php
            ????
            echo "var _requestTime = " .  ???? . ";";
        ?>
        var RequestTime = new Date().getTime() - _requestTime;
    </script>
    Help me fill in the blanks.

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Javascript-Like Time Function

    You can detect how long your page takes by checking microtime() at the beginning and ending of your PHP page. However, you cannot account for the time that the client might take to render the CSS or HTML.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured