xtlsoft / cachedrecursion
Easily make cached calls especially in slowly recursions in PHP.
dev-master
2017-12-23 10:59 UTC
Requires
- php: >=5.4
This package is auto-updated.
Last update: 2024-10-25 17:18:18 UTC
README
Easily make cached calls especially in slowly recursions in PHP.
Install
composer require xtlsoft/cachedrecursion
Usage
<?php use \CachedRecursion\Factory; $func = Factory::cached( [ "n" ], function($param, $next, $solve){ if($param['n'] == 1) return $solve(1); else return $solve($param['n'] * $next($param['n']-1)); } ); echo $func(1);
Isn't it easy?