<?php$array = [0.0, 0.19, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25]; $result = [];for ($i = 1; $i < count($array); $i++) { $result[] = abs($array[$i - 1] - $array[$i]);} print_r($result);?>
Standard input is empty
Array ( [0] => 0.19 [1] => 0.31 [2] => 0.25 [3] => 0.25 [4] => 0.25 [5] => 0.25 [6] => 0.25 [7] => 0.25 [8] => 0.25 )
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!