Page 1 of 1

Script Execution Time Help!!!

Posted: Wed Oct 01, 2003 8:28 pm
by AnsonM
Hi, I have this at the top of the page:

Code: Select all

<?
 $m_time = explode(" ",microtime()); 
 $m_time = $m_time[0] + $m_time[1]; 
 $starttime = $m_time;
?>
And at the bottom:

Code: Select all

<?
 $round = 3;// The number of decimal places to round the micro time to.
 $m_time = explode(" ",microtime()); 
 $m_time = $m_time[0] + $m_time[1]; 
 $endtime = $m_time; 
 $totaltime = ($endtime - $starttime); 
 echo "-[Script Execution Time: ". round($totaltime,$round) ." Seconds]-"; 
?>
How can I add in <font color> tags to the echo part of it? Because it keeps giving me parse errors when I change it to :

Code: Select all

<?php
 echo "<font color="#FFFFFF">-[Script Execution Time: ". round($totaltime,$round) ." Seconds]-</font>"; 
?>
Also, is there a tutorial I can read so I know next time how to add <font> tags to echo?
?>

Posted: Wed Oct 01, 2003 8:33 pm
by JAM

Code: Select all

echo '<font color="red">-[Script Execution Time: '. round($totaltime,$round) .' Seconds]-</font>'; 
// or
echo "<font color="red">-[Script Execution Time: ". round($totaltime,$round) ." Seconds]-</font>";
Using double quotes withing double quotes needs either changing the outer quotes to single quotes (example 1) or adding \ in front of the inner ones (example 2).

This is somewhat explained here...

Posted: Wed Oct 01, 2003 8:33 pm
by AnsonM
Thanks!