PHP code example of crisu83 / php-conversion

1. Go to this page and download the library: Download crisu83/php-conversion 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/ */

    

crisu83 / php-conversion example snippets


use Crisu83\Conversion\Quantity\DigitalInformation\DigitalInformation;
use Crisu83\Conversion\Quantity\Length\Length;
use Crisu83\Conversion\NumberBase\NumberBase;
use Crisu83\Conversion\Size\HatSize\HatSize;
use Crisu83\Conversion\Size\ShoeSize\ChildShoeSize;

use Crisu83\Conversion\Quantity\Length\Unit as LengthUnit;
use Crisu83\Conversion\Quantity\DigitalInformation\Unit as DIUnit;
use Crisu83\Conversion\Size\HatSize\System as HatSizeSystem;
use Crisu83\Conversion\Size\ShoeSize\System as ShoeSizeSystem;

XADECIMAL);
echo $number . '<br>';
echo $number->to(NumberBase::DECIMAL) . '<br>';
echo $number->to(NumberBase::OCTAL) . '<br>';
echo $number->to(NumberBase::BINARY) . '<br>';

echo '<br>';

$hatSize = new HatSize(40, HatSizeSystem::CENTIMETRE);
echo $hatSize . '<br>';
echo $hatSize->to(HatSizeSystem::AMERICAN) . '<br>';
echo $hatSize->to(HatSizeSystem::BRITISH) . '<br>';
echo $hatSize->to(HatSizeSystem::INCH) . '<br>';

echo '<br>';

$shoeSize = new ChildShoeSize(20, ShoeSizeSystem::EUROPEAN);
echo $shoeSize . '<br>';
echo $shoeSize->to(ShoeSizeSystem::AMERICAN) . '<br>';
echo $shoeSize->to(ShoeSizeSystem::BRITISH) . '<br>';
echo $shoeSize->to(ShoeSizeSystem::INCH) . '<br>';