PHP code example of bjoernffm / step-functions

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

    

bjoernffm / step-functions example snippets




use bjoernffm\stepFunctions\StepFunction;
use bjoernffm\stepFunctions\Interpolator;

nction(1, 2, function($input) { return -1*$input+2; });

$interpolator = new Interpolator();
$interpolator->add($first);
$interpolator->add($second);

echo $interpolator->getValue(0); // output 0
echo $interpolator->getValue(0.5); // output 0.5
echo $interpolator->getValue(1); // output 1
echo $interpolator->getValue(1.5); // output 0.5
echo $interpolator->getValue(2); // output 0