<?php
//список файлов который получен любым из способов, напр. scandir()
$files_list = [
'Яблоко.png',
'Апельсин.png',
'Арбуз.png',
'мандариН.png',
];
foreach($files_list as $file_name)
{
if(preg_match('!(Сочный|китайский|апельсин|мандарин)!usi', $file_name, $out))
{
echo "Found: {$out[1]} in {$file_name}\n";
}
}
//Found: Апельсин in Апельсин.png
//Found: мандариН in мандариН.png
<?php
const TOMATO = 'tomato';
const CARROT = 'carrot';
const APPLE = 'apple';
const POTATO = 'potato';
$basket = [
TOMATO => 15,
POTATO => 10,
CARROT => 5,
APPLE => 16,
];
$salad = [
TOMATO => 3,
POTATO => 2,
CARROT => 1,
];
function calculate(array $basket, array $salad): int
{
$total = max($basket);
foreach ($salad AS $key => $value) {
if ($value === 0) {
continue;
}
$total = min(floor(($basket[$key] ?? 0) / $value), $total);
}
return $total;
}
echo calculate($basket, $salad) . PHP_EOL;
Total: 5
$xR = preg_match_all("/[^,]+/",$data_point[2],$regD);
function delitem($iditem, $login, $kolvo, $linefile, $catalog, $effect34 = null, $effect33 = null)
<?php
$file_data = "Stuff you want to add\n";
$file_data .= file_get_contents('database.txt');
file_put_contents('database.txt', $file_data);
?>