I want this to execute the following code in PHP
linspace(1,7,4);
I want to have linear array list as an output.
function linspace($i,$f,$n){
$step = ($f-$i)/($n-1);
return range ($i,$f,$step);
}
$test = linspace(0,3.14159,8);
print_r($test);
I have written my own in some minutes. Please test it out.
function range
is your friend: http://php.net/manual/en/function.range.php
range(0, 12); //array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)