Page MenuHomePhorge

function phutil_units($description)
Arcanist Technical Documentation ()

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$descriptionHuman readable description of a unit quantity.
Return
intQuantity of specified unit.