UPDATE `TableName` SET `cnt` = 0 WHERE `id` IN (1314, 24414, 12121, 1141, 3453)
$query = 't';
$words = [
'habr',
'test',
];
usort($words, function ($first, $second) use ($query) {
similar_text($query, $first, $firstPercent);
similar_text($query, $second, $secondPercent);
return $firstPercent < $secondPercent;
});
echo "Запрос: $query", PHP_EOL;
echo 'Искомое слово: ', $words[0], PHP_EOL;
<?php
// Получение точек из $_POST
$points = $_POST['points'];
// Создание пустого изображения
$image = imagecreatetruecolor(400, 300);
// Создание цвета полигона
$col_poly = imagecolorallocate($image, 255, 255, 255);
// Рисование многоугольника
imagepolygon($image, $points, count($points) / 2, $col_poly);
// Вывод картинки в браузер
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
<?php
$pointsCount = $_GET['points_count'];
if ($pointsCount < 3) {
$pointsCount = 3;
}
?>
<form>
<label for="points_count">
Количество точек
</label>
<input type="number" min="3" value="<?= $pointsCount; ?>" name="points_count" id="points_count">
<input type="submit" value="Изменить количество точек">
</form>
<form action="figure.php" method="POST">
<?php for ($i = 1; $i <= $pointsCount; $i++): ?>
<!-- Точка <?= $i; ?> -->
<div>
<label for="x<?= $i; ?>">
X<sub><?= $i; ?></sub>:
</label>
<input type="number" min="0" name="points[]" id="x<?= $i; ?>">
<label for="y<?= $i; ?>">
Y<sub><?= $i; ?></sub>:
</label>
<input type="number" min="0" name="points[]" id="y<?= $i; ?>">
</div>
<?php endfor; ?>
<div>
<input type="submit" value="Нарисовать многоугольник">
</div>
</form>
sudo yum install php-mysqli
sudo dnf install php-mysqli
$a = [
'address' => [
'city' => 'Moscow'
]
];
$b = [
'address' => [
'country' => 'Russia'
]
];
$c = array_merge_recursive($a, $b);
var_dump($c);
zip -r -9 backup-`date +"%d-%m-%Y_%H.%M"`.zip /home/sergey/.
$data = '{"1st_half": 55}';
$data = json_decode($data, true);
var_dump($data['1st_half']);
unset($addons[$id]);
update_option('paid_addons', $addons);
unset()
как аргумент, т.к. unset()
возвращает void
$data = file_get_contents('data.json');
$data = json_decode($data, true);
$data['name'] = 'Vasiliy';
$data = json_encode($data);
file_put_contents('data.json', $data);
$myfunc = function ($matches) { return str_replace("\n", "<WPPreserveNewline />", $matches[0]); }