PHP: microtime() function
Description
The microtime() function creates current Unix timestamp with microseconds values.
Version:
(PHP 4 and above)
Syntax:
microtime(get_as_float)
Parameter:
Name | Description | Required / Optional |
Type |
---|---|---|---|
get_as_float | When it set to true then a float (in seconds) is returned instead of a string. | Optional | Boolean |
Return value:
Unix timestamp
Value Type: Mixed*.
*Mixed : Mixed indicates multiple (but not necessarily all) types.
Example:
<?php
echo(microtime());
?>
Output:
0.01583100 1295421766
Note: Since the current time is not static, therefore the output may vary.
View the example in the browser
See also
PHP: Tips of the Day
PHP: Anonymous recursive PHP functions
In order for it to work, you need to pass $factorial as a reference
$factorial = function( $n ) use ( &$factorial ) { if( $n == 1 ) return 1; return $factorial( $n - 1 ) * $n; }; print $factorial( 5 );
Ref : https://bit.ly/38dj7jm
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- React - JavaScript Library
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework