Store independent task results in scalar slots before summarizing them.

Task Result Slots

task_result_slots.php
<?php
function fill_read_slot($value) {
    return $value + 10;
}

function fill_write_slot($value) {
    return $value * 3;
}

$seed = ;
$readSlot = 0;
$writeSlot = 0;

$readSlot = fill_read_slot($seed);
$writeSlot = fill_write_slot($seed);
$total = $readSlot + $writeSlot;

echo "read=" . $readSlot . "\n";
echo "write=" . $writeSlot . "\n";
echo "total=" . $total . "\n";
<?php
function fill_read_slot($value) {
    return $value + 10;
}

function fill_write_slot($value) {
    return $value * 3;
}

$seed = ;
$readSlot = 0;
$writeSlot = 0;

$readSlot = fill_read_slot($seed);
$writeSlot = fill_write_slot($seed);
$total = $readSlot + $writeSlot;

echo "read=" . $readSlot . "\n";
echo "write=" . $writeSlot . "\n";
echo "total=" . $total . "\n";
<?php
function fill_read_slot($value) {
    return $value + 10;
}

function fill_write_slot($value) {
    return $value * 3;
}

$seed = ;
$readSlot = 0;
$writeSlot = 0;

$readSlot = fill_read_slot($seed);
$writeSlot = fill_write_slot($seed);
$total = $readSlot + $writeSlot;

echo "read=" . $readSlot . "\n";
echo "write=" . $writeSlot . "\n";
echo "total=" . $total . "\n";
task slots Separate result slots make replay easier to follow because each task updates its own scalar state.