$answer = array(
array("id" => 1, "parent_id" => 100, "name" => "Стулья"),
array("id" => 2, "parent_id" => 100, "name" => "Столы"),
array("id" => 5, "parent_id" => 1, "name" => "Стул Сакура", "price" => 5691, "img" => "lorempixel.com/900/900/?q=5", "props" => array()),
array("id" => 9, "parent_id" => 2, "name" => "Стол Византия", "price" => 5268, "img" => "lorempixel.com/900/900/?q=9","props" => array())
);
$result = array();
foreach($answer as $item) {
if(isset($item['price'])) $result[$item['parent_id']][] = $item;
else $result[$item['id']] = $item;
}
var_dump($result);
$tmp_firstname = $firstname;
shuffle($tmp_firstname);
array_splice($tmp_firstname, 5);
$tmp_lastname = $lastname;
shuffle($tmp_lastname);
array_splice($tmp_lastname, 5);
foreach($tmp_firstname as $key => $str) {
$tmp_firstname[$key] .= ' '.$tmp_lastname[$key];
}
$name=implode(', ', $tmp_firstname).'.';
<div data-baked="yes"></div>
div:not([data-baked="yes"]) {
display: none;
}
<?php
$i = 6;
foreach ($this->serverList as $value) {
if ($value['check'] == true) $checked=" checked ";
else $checked = " ";
echo '<td style="width:66px;"><input type="checkbox" name="top_'.$value['top'].'"'.$checked.'/>.'.$value['top'].'</td>';
$i++;
if ($i > 0) {
$i = 0;
echo '</tr><tr>';
}
}
?>
<?php
$i = 3;
foreach ($this->serverList as $value) {
if ($value['check'] == true) $checked=" checked ";
else $checked = " ";
echo '<td style="width:66px;"><input type="checkbox" name="top_'.$value['top'].'"'.$checked.'/>.'.$value['top'].'</td>';
$i++;
if ($value['check'] == true) $checked=" checked ";
else $checked = " ";
echo '<td style="width:66px;"><input type="checkbox" name="top_'.$value['top'].'"'.$checked.'/>.'.$value['top'].'</td>';
$i++;
if ($i > 0) {
$i = 0;
echo '</tr><tr>';
}
}
?>