LightPHPFramework

Math Class

This class provides several functions to perform some calculations.


List of public methods

Here is a list of available public methods for this class:


netto($brutto, $tax = null)

This function will return the net amount based on given brutto value and tax rate. If no percentage is given, the tax rate from the configuration will be used.

Static Yes
Parameters Parameter Type Default Description
$brutto mixed Brutto amount.
$tax mixed null Optional value of given tax rate.
Example
		
Math::netto(19.95, 19);
		
	

brutto($netto, $tax = null)

This function will return the brutto amount based on given netto value and tax rate. If no percentage is given, the tax rate from the configuration will be used.

Static Yes
Parameters Parameter Type Default Description
$netto mixed Brutto amount.
$tax mixed null Optional value of given tax rate.
Example
		
Math::brutto(16.764, 19);
		
	

percentage_value($basic_value, $percentage = null)

This function calculate the percentage value based on given basic value and percentage. If no percentage is given, the tax rate from the configuration will be used.

Static Yes
Parameters Parameter Type Default Description
$basic_value mixed Brutto amount.
$percentage mixed null Optional value of given percentage.
Example
		
Math::percentage_value(100, 10);
		
	

percentage($basic_value, $percentage_value)

This function calculate the percentage based on given basic value and percentage value.

Static Yes
Parameters Parameter Type Default Description
$basic_value mixed Basic value.
$percentage_value mixed Percentage value.
Example
		
Math::percentage(100, 10);
		
	

basic_value($basic_value, $percentage_value)

This function calculate the basic value based on given percentage value and percentage. If no percentage is given, the tax rate from the configuration will be used.

Static Yes
Parameters Parameter Type Default Description
$percentage_value mixed Percentage value.
$percentage mixed null Percentage.
Example
		
Math::basic_value(10, 10);
		
	

square_metre($length, $width)

This function calculate the square metre value based on given values.

Static Yes
Parameters Parameter Type Default Description
$length mixed Length value.
$width mixed Width value.
Example
		
Math::square_metre(4, 3);
		
	

cubic_metre($length, $width, $height)

This function calculate the cubic metre value based on given values.

Static Yes
Parameters Parameter Type Default Description
$length mixed Length value.
$width mixed Width value.
$height mixed Height value.
Example
		
Math::cubic_metre(4, 3, 2.5);
		
	

cubic_in_litre($cubic_metre)

This function calculate how many litre water is given cubic metre.

Static Yes
Parameters Parameter Type Default Description
$cubic_metre mixed Cubic metre value.
Example
		
Math::cubic_in_litre(16);
		
	

mph($miles, $time)

This function return miles per hour based on given values.

Static Yes
Parameters Parameter Type Default Description
$miles mixed Miles value.
$time mixed Time value.
Example
		
Math::mph(50, 1);
		
	

kmh($km, $time)

This function return kilometers per hour based on given values.

Static Yes
Parameters Parameter Type Default Description
$km mixed Kilometer value.
$time mixed Time value.
Example
		
Math::kmh(60, 1);
		
	

speed($distance, $time, $distance_unit = 'km', $speed_unit = 'kmh')

This function return kmh or mph based on given miles or kilometers.

Static Yes
Parameters Parameter Type Default Description
$distance mixed Distance value.
$time mixed Time value.
$distance_unit mixed km Distance unit: Possible values are "km" or "miles".
$speed_unit mixed kmh Speed unit: Possible values are "kmh" or "mph".
Example
		
Math::speed(129, 70, 'km', 'kmh');
		
	

km_in_miles($km)

This function return given kilometers in miles.

Static Yes
Parameters Parameter Type Default Description
$km mixed Kilometer value.
Example
		
Math::km_in_miles(50);
		
	

miles_in_km($miles)

Static Yes
Parameters Parameter Type Default Description
$miles mixed Miles value.
Example
		
Math::miles_in_km(31.068);
		
	

temperature($value, $source_scale, $target_scale)

Static Yes
Parameters Parameter Type Default Description
$value Numeric Source temperature value.
$source_scale String Source temperature scale.
Valid scales: celsius, kelvin, rankine, fahrenheit, reaumur.
$target_scale String Target temperature scale.
Valid scales: celsius, kelvin, rankine, fahrenheit, reaumur.
Example
		
Math::temperature(17, 'celsius', 'fahrenheit');