<input type="hidden" value="" name="i"><label><input type="checkbox" value="yes" name="i">Согласен</label>
if (!is_set($_POST['i']))
{
echo 'не отмечено';
}
else {
echo 'отмечено';
}
function convert($data) {
$result = [];
$needle = NIL;
foreach ($data as $item) {
if ($item - 1 !== $needle) {
if ($needle !== NIL) {
$obj['end'] = $needle;
$result[] = $obj;
}
$obj = ['start' => $item];
}
$needle = $item;
}
$obj['end'] = $item;
$result[] = $obj;
return $result;
}
print_r(convert([0, 1, 2, 3, 4, 5]));
print_r(convert([0, 1, 2, 3, 6, 7, 8, 9, 12, 13, 14, 15]));
print_r(convert([94, 95]));
print_r(convert([0, 1, 94, 95]));