<?php
require 'test/foo.php';
<?php
require './buz.php';
<?php
echo 'buz', PHP_EOL;
$ php main.php
PHP Fatal error: Uncaught Error: Failed opening required './buz.php'
<?php
require __DIR__ . '/test/foo.php';
<?php
require __DIR__ . '/buz.php';
<?php
echo 'buz', PHP_EOL;
$ php main.php
buz
Files SHOULD either declare symbols (classes, functions, constants, etc.) or cause side-effects (e.g. generate output, change .ini settings, etc.) but SHOULD NOT do both.
{categoryId: {name: 'category_name', services: [services_list]}}
и выводить уже подготовленные и отсортированные данные. $t1 = (new DateTimeImmutable('1900-01-01T00:00:00'))->getTimestamp();
$t2 = (new DateTimeImmutable('1950-01-01T00:00:00'))->getTimestamp();
$t = rand($t1, $t2);
print (new DateTimeImmutable())->setTimestamp($t)->format(DateTimeInterface::RFC3339);
// 1915-10-14T19:08:14+00:00
$arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18];
usort(
$arr,
function (int $a, int $b): int {
$result = (($a - 1) % 6) - (($b - 1) % 6);
return $result === 0 ? $a - $b : $result;
}
);
print_r($arr);
/* Array
(
[0] => 1
[1] => 7
[2] => 13
[3] => 2
[4] => 8
[5] => 14
[6] => 3
[7] => 9
[8] => 15
[9] => 4
[10] => 10
[11] => 16
[12] => 5
[13] => 11
[14] => 17
[15] => 6
[16] => 12
[17] => 18
) */