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
integer
dateDiff(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 |
---|
string
Intervals to be counted in or combined value (e.g. 1y, 2q)
integer
Number of intervals to count
integer
UTS date
integer
grossFromNet(float $net, float $rate, integer $resultflag, mixed $round) : mixed
float
Net value
float
Percentage rate to use for calculations
integer
See class constants. Return Total, Difference or array with both
mixed
Places to round to. Integer or False
mixed
Float or Array. See above.keyName(array $a, integer $pos) : string
array
Subject
integer
Key position
string
Name 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
float
Gross value
float
Percentage rate to use for calculations
integer
See class constants. Return Total, Difference or array with both
mixed
Places to round to. Integer or False
mixed
Float 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 |
---|
float
Value to round
integer
Precision to round to (decimal places)
string
Decimal Separator
float