PHP code example of skoyah / unit-converter

1. Go to this page and download the library: Download skoyah/unit-converter 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/ */

    

skoyah / unit-converter example snippets


use Skoyah\Converter\Mass;

$mass = new Mass(1, 'kg');
echo $mass->to('pounds'); // '2.20462262'

echo $mass->to('lbs'); // '2.20462262'

echo $mass->to('lbs', 2); // '2.20'