PHP code example of diversified-design / mesuraphp

1. Go to this page and download the library: Download diversified-design/mesuraphp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

diversified-design / mesuraphp example snippets


use Mesura\Length\Meter;
use Mesura\Temperature\Celsius;
use Mesura\Volume\Pint;

Meter::unitSystem();    // UnitSystem::SI
Celsius::unitSystem();  // UnitSystem::Metric
Pint::unitSystem();     // UnitSystem::USCustomary

$celsius = new Celsius(28);
# $celsius = (Mesura\Temperature\Celsius) 28

$fahrenheit = $celsius->toFahrenheit();
# $fahrenheit = (Mesura\Temperature\Fahrenheit) 82.4

$fahrenheit = (new Celsius(28))->toFahrenheit();
shell
composer