PHP code example of kidjapa / php-goalseek

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

    

kidjapa / php-goalseek example snippets


$goalSeek = new SolveGoalSeek();

$getValue = 0;

$getValue = $goalSeek->seekGoal(
    function($value, $data){
        return sqrt($value);
    },
    16,  // The Actual Value
    20   // The Goal Value
);

echo "------------- results ------------- \n";
echo "Result: ".$getValue."\n"; // Expect: 400
bash
 composer