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.
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.