e1seix Posted May 5, 2008 Share Posted May 5, 2008 Hi again, Busy night. Have wondered about how long it takes one of my lengthy scripts to execute so I can calculate my cron jobs and not have them overlapping. I have found this $time = microtime(); $time = explode(" ", $time); $time = $time+ $time[0]; $time1 = $time; CODE THAT NEEDS TIMING $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $time2 = $time; $totaltime = ($time2 - $time1); echo '<BR>Parsing time: ' .$totaltime. ' seconds.'; However, I keep getting "Fatal error: Unsupported operand types in /home/e1seix/public_html/controlPanel/update2.php on line 5". Is there a solution or an alternative? Many thanks. PS. Would really appreciate some help on my last thread. It's going further and further down the page and I don't want to bump it. lol Honestly, thank you everyone! Link to comment https://forums.phpfreaks.com/topic/104285-calculating-time-takes-script-to-execute/ Share on other sites More sharing options...
DarkWater Posted May 5, 2008 Share Posted May 5, 2008 $time = microtime(); $time = explode(" ", $time); $time = $time+ $time[0]; You're setting $time equal to an array in line 2, and then trying to use it in an addition statement. Use new names. =P Link to comment https://forums.phpfreaks.com/topic/104285-calculating-time-takes-script-to-execute/#findComment-533925 Share on other sites More sharing options...
e1seix Posted May 5, 2008 Author Share Posted May 5, 2008 Say what? That's a little too advanced for me, especially at this time of night. Does that mean I have to change something in the second bit after the CODE bit too? Link to comment https://forums.phpfreaks.com/topic/104285-calculating-time-takes-script-to-execute/#findComment-533929 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.