1. Go to this page and download the library: Download samsara/fermat 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/ */
use Samsara\Fermat\Core\Core\Numbers;
use Samsara\Fermat\Core\Core\Enums\NumberBase;
// Value in base5
$five = Numbers::make(Numbers::IMMUTABLE, '10', null, NumberBase::Five);
// Value in base10
$ten = Numbers::make(Numbers::IMMUTABLE, '10');
echo $ten->add($five); // Prints: "15" (The sum in base10)
echo $five->add($ten); // Prints: "30" (The sum in base5)
use Samsara\Fermat\Core\Core\Values\ImmutableDecimal;
use Samsara\Fermat\Core\Core\Values\ImmutableFraction;
$five = new ImmutableDecimal(5);
$oneQuarter = new ImmutableFraction(1, 4);
echo $five->add($oneQuarter); // Prints: "5.25"
// The asDecimal() method is called on $oneQuarter
echo $oneQuarter->add($five); // Prints: "21/4"
// Calls getValue() on $five and instantiates a new ImmutableFraction
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.