<?php
function getRows($file) {
$handle = fopen($file, 'rb');
if ($handle === false) {
throw new Exception();
}
while (feof($handle) === false) {
yield fgetcsv($handle);
}
fclose($handle);
}
foreach (getRows('data.csv') as $row) {
print_r($row);
}
<?php
// создаем дочерний процесс
$child_pid = pcntl_fork();
if ($child_pid) {
// выходим из родительского, привязанного к консоли, процесса
exit;
}
.....
preg_replace_callback(
'~[А-ЯЁA-Z]{2,}~u',
function ($match) {
return mb_strtolower($match[0], 'utf-8');
},
'Товар "Диван Амстердам" МИКС, акция, ОГРАНИЧЕННАЯ ПАРТИЯ'
);
if (class_exists('\CURLFile')) {
curl_setopt($ch, CURLOPT_POSTFIELDS, ['file1' => new \CURLFile($path)]);
} else {
curl_setopt($ch, CURLOPT_POSTFIELDS, ['file1' => "@$path"]);
}
print_r(curl_getinfo($cURLsession))
<?php
$formatter = new IntlDateFormatter('ru_RU', IntlDateFormatter::FULL, IntlDateFormatter::FULL);
$formatter->setPattern('d MMMM YYYY года HH:mm');
echo $formatter->format(DateTime::createFromFormat('d.m.Y H:i:s', '23.03.2016 17:30:00')); //23 марта 2016 года 17:30