How to Display Execution Time in PHP

How to Display Execution Time in PHP. A simple Php program to print the time using the keyword time. By using this keyword we can print the time. In PHP, the time() function returns all of the information you need about the current date and time. It takes no parameters and returns an integer. 

<?php

print time();

?>

Output:

1627430780

Time() Function in Php

The time() function in PHP delivers the current time in seconds since the Unix Epoch. To convert the amount of seconds to the current date, utilise PHP’s date() function. The number of seconds since midnight GMT on January 1, 1970 is represented by the integer given by time. This is the UNIX epoch, and the time stamp represents the number of seconds since then.

Function in PHP Programming

In PHP, a function is a reusable piece of code that performs a certain operation. When called, functions can either return values or just conduct an action without returning any value. PHP includes around 700 built-in functions that accomplish various tasks. PHP offers us with two kinds of functions: Built-in functions: PHP comes with a plethora of built-in library functions. User Defined Functions: In addition to the built-in functions, PHP allows us to write our own customised functions, known as user-defined functions.