<input type="text" name="answers[0][answer]">
<input type="checkbox" name="answers[0][right]" value="1" >
<input type="text" name="answers[1][answer]">
<input type="checkbox" name="answers[1][right]" value="1" >
<input type="text" name="answers[2][answer]">
<input type="checkbox" name="answers[2][right]" value="1" >
<?php
$arr = [
'0' => [
'foo1' => 'bar1',
'foo2' => 'bar2',
'foo3' => 'buz1',
'floor' => 1,
],
'1' => [
'foo1' => 'bar1',
'foo2' => 'bar2',
'foo3' => 'buz2',
'floor' => 7,
],
'3' => [
'foo1' => 'bar3',
'foo2' => 'bar4',
'foo3' => 'buz3',
'floor' => 1,
],
];
$result = [];
foreach ($arr as $item)
{
$key = $item['foo1'].'&'.$item['foo2']; // Разделитель для ключа нужно подбирать исходя из того, что хранится в foo1 и foo2
if (!array_key_exists($key, $result))
{
$result[$key] = [
'foo1' => $item['foo1'],
'foo2' => $item['foo2'],
'dependence' => []
];
}
$result[$key]['dependence'][$item['floor']] = $item['foo3'];
}
$result = array_values($result);
echo '<pre>';
var_dump($result);
echo '</pre>';
?>
$array = range(1, 16);
shuffle($array);
echo implode('<br/>', array_slice($array, 0, 4));
public function check($orderId)
{
$url = $this->url.'load_adv_adv.php';
$pageid = 0;
$found = false;
while (!$found)
{
$result = $this->http($url, array('page' => $pageid), true);
preg_match('/({[^{}]*?'.$orderId.'.+?})/', $result, $matches);
if (isset($matches[1]))
{
$found = true;
$order = $matches[1];
}
else
{
$pageid++;
}
}
return $order;
}
public function check($orderId)
{
$url = $this->url.'load_adv_adv.php';
$pageid = 0;
while (true)
{
$result = $this->http($url, array('page' => $pageid), true);
preg_match('/({[^{}]*?'.$orderId.'.+?})/', $result, $matches);
if (isset($matches[1]))
{
return $matches[1];
}
$pageid++;
}
}