PHP code example of gries / pokemath

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

    

gries / pokemath example snippets




use gries\Pokemath\Numbers\Ivysaur;
use gries\Pokemath\Numbers\Jigglypuff;
use gries\Pokemath\Numbers\Snorlax;
use gries\Pokemath\Numbers\Venusaur;
use gries\Pokemath\Numbers\Wigglytuff;

ff();

echo $jiggly->multiply($wiggly)->value()."\n"; // -> ivysaur-chespin


// make it even bigger
$snorlax = new Snorlax();
echo $snorlax
        ->multiply($snorlax)
        ->multiply($snorlax)
        ->multiply($snorlax)
        ->multiply($snorlax)
        ->multiply($snorlax)
        ->value()."\n"; // -> nidorino-sandslash-klinklang-drifloon-gothita
        
// make calculations

$calculator = new \gries\Pokemath\PokeCalculator();

$expression = '(ivysaur + ivysaur) * ivysaur#ivysaur';
$result = $calculator->calculate('(ivysaur + ivysaur) * ivysaur#ivysaur');

echo $expression."\n";                                                  
// -> (ivysaur + ivysaur) * ivysaur#ivysaur
echo $calculator->translate($expression);                              
echo ' = '.$result->value(). '('.$result->asDecimalString().")\n";      
// -> (1 + 1) * 701 = venusaur#venusaur(1402)
bash
php data/generator.php