1. Go to this page and download the library: Download ktsirangelos/math-functions 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/ */
ktsirangelos / math-functions example snippets
use MathFunctions\IntegerCalculator;
$integerCalculator = new IntegerCalculator();
// Example usage with integer 12
$divisors = $integerCalculator->calcDivisors(12);
// Expected Output: [-6, -4, -3, -2, 2, 3, 4, 6]
use MathFunctions\IntegerCalculator;
$integerCalculator = new IntegerCalculator();
// Example usage with integer 5
$factorial = $integerCalculator->calcFactorial(5);
// Expected Output: 120
use MathFunctions\IntegerCalculator;
$integerCalculator = new IntegerCalculator();
// Example usage with an array of integers
$primeNumbersXML = $integerCalculator->calcPrimeNumbers([2, 3, 4, 5, 6, 7]);
// Expected Output (XML string):
// <primeNumbers amount="4">
// <result>
// <number>2</number>
// <number>3</number>
// <number>5</number>
// <number>7</number>
// </result>
// </primeNumbers>
use MathFunctions\Utilities\ResultFormatter;
$resultFormatter = new ResultFormatter();
// Example usage with an array of even numbers
$xmlResult = $resultFormatter->toXML('evenNumbers', [2, 4, 6, 8]);
// Expected Output (XML string):
// <evenNumbers amount="4">
// <result>
// <number>2</number>
// <number>4</number>
// <number>6</number>
// <number>8</number>
// </result>
// </evenNumbers>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.