-
July 15th, 2009, 01:22 PM
#1
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.
-
July 15th, 2009, 02:53 PM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|