Static methods providing calculations.
| package | dstruct_common |
|---|
bytes(string $val) : integer
Particularly useful when parsing parameters from php.ini. The method was converted from one from http://www.php.net/manual/en/function.ini-get.php. $val should be expressed as a float followed by 'k', 'm' or 'g' (not case sensitive) to denote the size 'scale'. Return is an integer, rounded where necessary. e.g. 1k returns 1024 1.2k returns 1229
string
integerdateDiff(string $interval, integer $number, integer $date) : integer
WARNING: This method may well have bugs. It is better to use strtotime() or the Date object! It is likely to be deprecated in future. Interval can be one of: y = year, q = quarter, m = month, w = week, d = day, h = hour, m = minute, s = second. Combined values can be send to $interval such as 1q or 3y. In these instances, $number is ignored.
| todo | Handle incorrect parameters |
|---|
stringIntervals to be counted in or combined value (e.g. 1y, 2q)
integerNumber of intervals to count
integerUTS date
integergrossFromNet(float $net, float $rate, integer $resultflag, mixed $round) : mixed
floatNet value
floatPercentage rate to use for calculations
integerSee class constants. Return Total, Difference or array with both
mixedPlaces to round to. Integer or False
mixedFloat or Array. See above.keyName(array $a, integer $pos) : string
arraySubject
integerKey position
stringName of the keynetFromGross(float $gross, float $rate, integer $resultflag, mixed $round) : mixed
If $diff is true, an array is returned with keys 'total' and 'diff'.
'total' is the gross value and 'diff' is the difference between net and gross.
If $diff is false, returns float
floatGross value
floatPercentage rate to use for calculations
integerSee class constants. Return Total, Difference or array with both
mixedPlaces to round to. Integer or False
mixedFloat or Array. See above.round(float $number, integer $precision, string $decsep) : float
See https://svn0.conceptia.co.uk/web/wiki/PhpGotchas for more information Not sure where this function came from.
| todo | complete long description |
|---|
floatValue to round
integerPrecision to round to (decimal places)
stringDecimal Separator
float