function phutil_units($description)libphutil Technical Documentation (Core Utilities)
function phutil_units($description)
libphutil Technical Documentation (Core Utilities)
Convert a human-readable unit description into a numeric one. This function allows you to replace this:
$ttl = (60 * 60 * 24 * 30); // 30 days
...with this:
$ttl = phutil_units('30 days in seconds');
...which is self-documenting and difficult to make a mistake with.
Parameters
string | $description | Human readable description of a unit quantity. |
Return
int | Quantity of specified unit. |
- Defined
- src/utils/utils.php:1141