// Create a request
$request = (new Zend\Diactoros\Request())
->withUri(new Zend\Diactoros\Uri('http://example.com'))
->withMethod('PATCH')
->withAddedHeader('Authorization', 'Bearer ' . $token)
->withAddedHeader('Content-Type', 'application/json');
// OR:
$request = new Zend\Diactoros\Request(
'http://example.com',
'PATCH',
'php://memory',
[
'Authorization' => 'Bearer ' . $token,
'Content-Type' => 'application/json',
]
);
// If you want to set a non-origin-form request target, set the
// request-target explicitly:
$request = $request->withRequestTarget((string) $uri); // absolute-form
$request = $request->withRequestTarget($uri->getAuthority()); // authority-form
$request = $request->withRequestTarget('*'); // asterisk-form
// Once you have the instance:
$request->getBody()->write(json_encode($data));
$response = $client->send($request);
$var = $var / 5;
require_once ( "../app/core.php" );
// пример роутинга
if ( file_exists("../app/".$module."/conf.php") ) {
require_once ( $module."/conf.php" );
require_once ( "header.php" );
require_once ( $module."/i.php" );
require_once ( "footer.php" );
} else {
require_once ( "404/i.php" );
}
// 1
$rand = 'a3ace35a76f868925611a3dac02256da4cc62c2010a480e15c5c1';
echo preg_replace('/\d/', '*', $rand, 1); // a*ace35a76...
// 2 (решение "в лоб", и оттого немного более многострочный вариант)
$rand = 'a3ace35a76f868925611a3dac02256da4cc62c2010a480e15c5c1';
for ($i = 0; $i < strlen($rand); $i++) {
if (is_numeric($rand{$i})) {
$rand{$i} = '*';
break;
}
}
echo $rand; // a*ace35a76...
$pow = ceil(count($array) / 2);
$arr = array_map(function($n) use($sum, &$pow) {
$pow -= 1;
return $sum * (1 + (1 - (2 ** -abs($pow))) * ($pow < 0 ? -1 : 1));
}, $array);
$begin = new DateTime( '2019-01-10' );
$end = new DateTime( '2019-02-10');
$end = $end->modify( '+1 day' ); // если надо включительно
$interval = new DateInterval('P1D');
$daterange = new DatePeriod($begin, $interval ,$end);
foreach($daterange as $date){
echo $date->format("Y-m-d") . "\n";
}
$path = '.';
$directory = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS);
$iterator = new RecursiveIteratorIterator($directory);
$iterator->setMaxDepth(2);
foreach ($iterator as $path => $info) {
echo $path, "\n";
}