Script Execution Time Help!!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
AnsonM
Forum Commoner
Posts: 72
Joined: Thu Sep 25, 2003 7:21 am

Script Execution Time Help!!!

Post 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?
?>
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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...
Last edited by JAM on Wed Oct 01, 2003 8:35 pm, edited 1 time in total.
AnsonM
Forum Commoner
Posts: 72
Joined: Thu Sep 25, 2003 7:21 am

Post by AnsonM »

Thanks!
Post Reply