Saturday, November 16, 2013

Timing your PHP Code in BlueBox

If you think a piece of PHP code is inefficient but don't know where, there is a BlueBox function that can give you time-splits as the code progresses.

bb_timer([optional __LINE__ number],[optional return_value]);

The simplest use would be bb_timer(__LINE__); which will print to the screen the time taken to get to that specific line of code.

If you would rather have the value returned then enter a 'true' value into the second value.