Code slow down on function call

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
Bubastis
Forum Newbie
Posts: 1
Joined: Sat Jul 24, 2004 1:18 pm

Code slow down on function call

Post by Bubastis »

I'm using php 4.3.8. I have a big class called template which has a function pparse which takes one argument.

In my code, I do a timestamp (using microtime), then I execute $template->pparse('body'). The first line of the pparse function then is another timestamp. Often 4 seconds or more pass between these timestamps. Any suggestion why? I'm running the php on a debian Linux system with apache; this is part of a web page.

Thanks.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

You sure your suing microtime correctly??

Code: Select all

$mtime = explode(" ",microtime());
$start = $mtime[1] + $mtime[0];

myfunction('page', $start); //call function

function myfunction($word, $start){
   $mtime = explode(" ",microtime());
   $endtime = $mtime[1] + $mtime[0];
   $timetaken = $endtime-$start;
   echo $timetaken;
   
   //rest of function

}
Post Reply