<?php
$a = array(
array(
"year" => 0,
"serial" => 0
),
array(
"year" => 0,
"serial" => 13000
),
array(
"year" => 0,
"serial" => 13640
),
array(
"year" => 0,
"serial" => 14280
)
);
$prev = $a[0]['serial'];
for($i = 1; $i < count($a); $i++) {
$diff = $a[$i]['serial'] - $prev;
$prev = $a[$i]['serial'];
$a[$i]['serial'] = $diff;
}
print_r($a);
РезультатArray
(
[0] => Array
(
[year] => 0
[serial] => 0
)
[1] => Array
(
[year] => 0
[serial] => 13000
)
[2] => Array
(
[year] => 0
[serial] => 640
)
[3] => Array
(
[year] => 0
[serial] => 640
)
)