Esi\Utility\Conversion
- fahrenheitToCelsius(float $fahrenheit, bool $rounded = true, int $precision = 2): float;
- celsiusToFahrenheit(float $celsius, bool $rounded = true, int $precision = 2): float;
- celsiusToKelvin(float $celsius, bool $rounded = true, int $precision = 2): float;
- kelvinToCelsius(float $kelvin, bool $rounded = true, int $precision = 2): float;
- fahrenheitToKelvin(float $fahrenheit, bool $rounded = true, int $precision = 2): float;
- kelvinToFahrenheit(float $kelvin, bool $rounded = true, int $precision = 2): float;
- fahrenheitToRankine(float $fahrenheit, bool $rounded = true, int $precision = 2): float;
- rankineToFahrenheit(float $rankine, bool $rounded = true, int $precision = 2): float;
- celsiusToRankine(float $celsius, bool $rounded = true, int $precision = 2): float;
- rankineToCelsius(float $rankine, bool $rounded = true, int $precision = 2): float;
- kelvinToRankine(float $kelvin, bool $rounded = true, int $precision = 2): float;
- rankineToKelvin(float $rankine, bool $rounded = true, int $precision = 2): float;
- haversineDistance(int|float $startingLatitude, int|float $startingLongitude, int|float $endingLatitude, int|float $endingLongitude, int $precision = 0): array;
Convert Fahrenheit (Fº) To Celsius (Cº)
use Esi\Utility\Conversion;
echo Conversion::fahrenheitToCelsius(74); // 23.33
Convert Celsius (Cº) To Fahrenheit (Fº)
use Esi\Utility\Conversion;
echo Conversion::celsiusToFahrenheit(23.33); // 73.99
Convert Celsius (Cº) To Kelvin (K)
use Esi\Utility\Conversion;
echo Conversion::celsiusToKelvin(23.33); // 296.48
Convert Kelvin (K) To Celsius (Cº)
use Esi\Utility\Conversion;
echo Conversion::kelvinToCelsius(296.48); // 23.33
Convert Fahrenheit (Fº) To Kelvin (K)
use Esi\Utility\Conversion;
echo Conversion::fahrenheitToKelvin(74)); // 296.48
Convert Kelvin (K) To Fahrenheit (Fº)
use Esi\Utility\Conversion;
echo Conversion::kelvinToFahrenheit(296.48); // 73.99
Convert Fahrenheit (Fº) To Rankine (ºR)
use Esi\Utility\Conversion;
echo Conversion::fahrenheitToRankine(74); // 533.67
Convert Rankine (ºR) To Fahrenheit (Fº)
use Esi\Utility\Conversion;
echo Conversion::rankineToFahrenheit(533.67); // 74.0
Convert Celsius (Cº) To Rankine (ºR)
use Esi\Utility\Conversion;
echo Conversion::celsiusToRankine(30); // 545.67
Convert Rankine (ºR) To Celsius (Cº)
use Esi\Utility\Conversion;
echo Conversion::rankineToCelsius(545.67); // 30.0
Convert Kelvin (K) To Rankine (ºR)
use Esi\Utility\Conversion;
echo Conversion::kelvinToRankine(130); // 234.0
Convert Rankine (ºR) To Kelvin (K)
use Esi\Utility\Conversion;
echo Conversion::rankineToKelvin(234.0); // 130.0
Calculate the distance between two points using the Haversine Formula.
See Haversine_formula#Formulation
.
use Esi\Utility\Conversion;
$lat1 = 37.774_9;
$lon1 = -122.419_4;
$lat2 = 34.052_2;
$lon2 = -118.243_7;
$result = Conversion::haversineDistance($lat1, $lon1, $lat2, $lon2);
print_r($result);
/*
Array
(
[meters] => 559,119
[kilometers] => 559
[miles] => 347
)
*/