PHP code example of kostaspt / ivcalculator
1. Go to this page and download the library: Download kostaspt/ivcalculator 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/ */
kostaspt / ivcalculator example snippets
lculator = new IVCalculator\IVCalculator();
// Pokemon, CP, HP, Stardust needed for power up, Was powered up before?
$results = $ivCalculator->evaluate('Dragonite', 3280, 149, 9000, false);
var_dump($results->toArray());
/*
Outputs:
array:4 [
"id" => 149
"name" => "Dragonite"
"perfection" => array:3 [
"max" => 0.62
"min" => 0.8
"average" => 0.73
]
"ivs" => array:5 [
4 => IVCalculator\Entities\IV {#56
+attackIV: 13
+defenseIV: 6
+staminaIV: 9
+level: 76
+perfection: 0.62
}
1 => IVCalculator\Entities\IV {#59
+attackIV: 15
+defenseIV: 8
+staminaIV: 10
+level: 74
+perfection: 0.73
}
3 => IVCalculator\Entities\IV {#57
+attackIV: 9
+defenseIV: 15
+staminaIV: 10
+level: 75
+perfection: 0.75
}
2 => IVCalculator\Entities\IV {#58
+attackIV: 12
+defenseIV: 12
+staminaIV: 11
+level: 74
+perfection: 0.77
}
0 => IVCalculator\Entities\IV {#60
+attackIV: 15
+defenseIV: 9
+staminaIV: 12
+level: 73
+perfection: 0.8
}
]
]
*/
echo $results->get('name');
// Outputs: Dragonite
echo $results->get('perfection')->get('average');
// Outputs: 0.73
$highestIV = $results->get('ivs')->last();
echo $highestIV->perfection;
// Outputs: 0.8
bash
$ composer