p4/excel-goalseek 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

p4/excel-goalseek

最新稳定版本:v2.0.0

Composer 安装命令:

composer require p4/excel-goalseek

包简介

Utility to emulate goalseek function in PHP

README 文档

README

Scrutinizer Code Quality Code Coverage Build Status Code Intelligence Status

Utility to emulate goalseek function in PHP. This fork was made for very specific project, and there is no promise to keep any BC.

This library is a fork of PHP-Excel-GoalSeek

Install

Use package from packagist.

composer require p4/excel-goalseek

Usage

//Define function which for which the value should be found
$callbackTest = function callbackTest($input) {
    $inputForCallbackTest2 = $input * 8;
    return $inputForCallbackTest2 - 12;
};

//Instantiate goal seek class
$goalseek = new ExcelGoalSeek();
//$goalseek->debug = true;

//I want to know which input needs callbackTest to give me 301
$expected_result = 300;

//Calculate the input to get you goal, with accuracy
$input = $goalseek->calculate($callbackTest, $expected_result, 5);

//Voilá!
echo "\$input: " . $input . "<br />";

//Let's test our input it is close
$actual_result = $callbackTest($input);
//Searched result of function
echo "Searched result of $callbackTest(\$input) = " . $expected_result . "<br />";
//Actual result of function with calculated goalseek
echo "Actual result of $callbackTest(" . $input . ") = " . $actual_result . "<br />";
//If difference is too high, you can improve the class and send me it your modifications ;)
echo "Difference = " . ($actual_result - $expected_result);

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 17.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-02