+$data = json_encode(
+ ['param' => $param],
+ JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
+);
$headers = array(
'Content-Type: application/json',
+ 'Content-Length: ' . strlen($data),
);
-$data = <<<DATA
-{
-"param": $param,
-}
-DATA;
--$conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
--$conn -> query("SET NAMES utf8");
++$conn = new PDO(
++ "mysql:host=$host;dbname=$dbname",
++ $username,
++ $password
++ [
++ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
++ PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'",
++ ],
++);
--$err = $conn -> query("INSERT INTO RECIPE(recipe_id,aspect_ratio,yields,cook_time_minutes,country,descriptions,prep_time_minutes,total_time_minutes,name,thumnai_url) VALUES('$id','$asp','$yie','$c_t_m','$country','$desc','$p_t_m','$t_t_m','$name','$t_url')");
--echo "\nrec PDOStatement::errorCode(): ";
--print $err->errorCode();
++$req = $conn->prepare(<<<REQ
++ INSERT INTO RECIPE (
++ recipe_id, aspect_ratio, yields, cook_time_minutes, country, descriptions,
++ prep_time_minutes,total_time_minutes,name,thumnai_url
++ ) VALUES (
++ :recipe_id, :aspect_ratio, :yields, :cook_time_minutes, :country, :descriptions,
++ :prep_time_minutes, :total_time_minutes, :name, :thumnai_url
++ )
++REQ);
++$req->execute([
++ 'recipe_id' => $data['id'],
++ 'aspect_ratio' => $data['aspectRatio'],
++ 'yields' => $data['yields'],
++ 'cook_time_minutes' => $data['cookTimeMinutes'],
++ 'country' => $data['country'],
++ 'descriptions' => $data['description'],
++ 'prep_time_minutes' => $data['prepTimeMinutes'],
++ 'total_time_minutes' => $data['totalTimeMinutes'],
++ 'name' => $data['name'],
++ 'thumnai_url' => $data['thumbnailUrl'],
++]);
/**
* @return array{uid: string, name: string, isAdmin: bool}
* @throws AuthenticationException on authentication error
*/
private static function authenticate(string $login, string $password): array
{
}
A full list of PHP operators follows in the section Operator Precedence.И квадратных скобок там нет.
If both operands are numeric strings, or one operand is a number and the other one is a numeric string, then the comparison is done numerically.
If a string is compared to a number or a numeric string then the string was converted to a number before performing the comparison.
++$data = '{"counter":{"mirrors2":[{"site":"test.example.com"},{"site":"test2.example.com"},{"site":"test3.example.com"},{"site":"test4.example.com"},{"site":"test5.example.com"}]}}';
$headers = [
"Host: api-metrika.yandex.net",
"Authorization: OAuth $TOKEN_VAR",
"Content-Type: application/x-yametrika+json",
++ "Content-Length: " . strlen($data),
];
--$data = '{"counter":{"mirrors2":[{"site":"test.example.com"},{"site":"test2.example.com"},{"site":"test3.example.com"},{"site":"test4.example.com"},{"site":"test5.example.com"}]}}';
The special area of "Etc" is used for some administrative zones, particularly for "Etc/UTC" which represents Coordinated Universal Time. In order to conform with the POSIX style, those zone names beginning with "Etc/GMT" have their sign reversed from the standard ISO 8601 convention. In the "Etc" area, zones west of GMT have a positive sign and those east have a negative sign in their name (e.g "Etc/GMT-14" is 14 hours ahead of GMT)https://en.wikipedia.org/wiki/Tz_database#Area
--$sql2 = "SELECT * FROM `servers`";
++$sql2 = "SELECT 'id' FROM `servers` WHERE `pay_date` = CURDATE()";
--$ress2 = mysqli_fetch_assoc($res2);
--while($ress2) {
++while ($ress2 = mysqli_fetch_assoc($res2)) {