$it = 1;
foreach ($results as $result) {
$active_sheet2->setCellValue('A'.$it, $result->yellowline1);
$active_sheet2->setCellValue('B'.$it, $result->yellowline2);
$active_sheet2->setCellValue('C'.$it, $result->yellowline3);
$active_sheet2->setCellValue('D'.$it, $result->yellowline4);
$it++;
}
$data = array(
0 => array(
'id' => 2,
'pagetitle' => 'Главная',
'parent' => 0
),
1 => array(
'id' => 3,
'pagetitle' => 'Категория',
'parent' => 2
),
2 => array(
'id' => 100,
'pagetitle' => 'Подкатегори 100',
'parent' => 5
),
3 => array(
'id' => 5,
'pagetitle' => 'Подкатегория 5 ',
'parent' => 2
)
);
$categories_array = array();
foreach ($data as $category) {
if (!in_array($category['id'], $categories_array)) {
$categories_array[$category['id']] = array();
$categories_array[$category['id']]['pagetitle'] = $category['pagetitle'];
$categories_array[$category['id']]['parent'] = $category['parent'];
}
}
echo '<pre>';
print_r($categories_array);
echo '</pre>';
function getRNDFiles($file, $number) {
$symbols = array_merge(range('a', 'z'), range(0, 9));
$exts = array('exe', 'png', 'jpg');
for ($it = 1; $it <= $number; $it++) {
shuffle($symbols);
$number_symbols = mt_rand(8, 10);
$new_filename = '';
for ($it_symbol = 1; $it_symbol <= $number_symbols; $it_symbol++) {
$new_filename .= $symbols[array_rand($symbols)];
}
$new_filename .= '.'.$exts[array_rand($exts)];
copy($file, './folder/'.$new_filename);
}
return true;
}
getRNDFiles('./file.txt', 10);