- var_dump: documentation ( source)
<?php
function yieldAll(array $total)
{
foreach ($total as $key => $value) {
$stmt = (yield $key => $value);
if (! $stmt) {
return;
}
}
}
$toto = [];
$res = yieldAll(['toto', 'tata', 'tutu']);
foreach ($res as $key => $value) {
if (1 == $key) {
$res->send(false);
}
$toto[$key] = $value;
}
var_dump($toto);