<?php
$arr = ["a","b","c","e"];
foreach($arr as $value){
if ( $value === 'b' ) continue;
echo $value;
}
function wc_ninja_remove_password_strength() {
if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) {
wp_dequeue_script( 'wc-password-strength-meter' );
}
}
add_action( 'wp_print_scripts', 'wc_ninja_remove_password_strength', 100 );
echo preg_replace_callback('~\[(.+?)\]~', fn($m) => $array[$m[1]] ?? $m[0], $message);
$(function() {
(function quantityProducts() {
$(".quantity-arrow-minus").click(quantityMinus);
$(".quantity-arrow-plus").click(quantityPlus);
function quantityMinus() {
let currentInput = $(this).parent().find('.quantity-num');
if (currentInput.val() > 0) {
currentInput.val(+currentInput.val() - 1);
}
}
function quantityPlus() {
let currentInput = $(this).parent().find('.quantity-num');
currentInput.val(+currentInput.val() + 1);
}
})();
});
$(".quantity-block").each(function() {
let currentInput = $(this).children('.quantity-num');
$(this).children('.quantity-arrow-minus').click(function() {
if (currentInput.val() > 0) {
currentInput.val(+currentInput.val() - 1);
}
});
$(this).children('.quantity-arrow-plus').click(function() {
currentInput.val(+currentInput.val() + 1);
});
});
//Это ваш код
$array = array(
"1" => array("id"=>"123", "name"=>"Alex"),
"2"=>array("id"=>"322", "name"=>"Pasha"),....
"22"=>array("id"=>"312", "name"=>"Lesha"),....);
// используйте роямое обращение по ключу
print_r($array[2]);
print_r($array[22])
//...etc
//Или вам нужно и применение цикла? и что бы цикл выводил только заданные ключи?
$arr = [
22 => 'one',
322 => 'two',
42 => 'three',
55 => 'four',
76 => 'five',
21 => 'six',
34 => 'seven',
];
$myKeys = [42, 76, 21];
$newArr = array_filter($arr, function($key) use ($myKeys) {
return in_array($key, $myKeys);
}, ARRAY_FILTER_USE_KEY);
print_r($newArr);
/** result
Array
(
[42] => three
[76] => five
[21] => six
)
**/
<svg>
<!-- Градиент -->
<linearGradient id="linear-gradient">
<stop offset="0%" stop-color="gold"/>
<stop offset="100%" stop-color="teal"/>
</linearGradient>
<!-- Фигура с градиентной заливкой -->
<rect fill="url(#linear-gradient)"
width="100%" height="100%"/>
</svg>
.luchshee-title{
font-size:20px;
display:inline-block;
position:relative;
z-index:3;
}
.luchshee-title:after{
display: block;
content: '';
background: #fedd00;
width: 100%; //не используйте волшебные числа, типа 314
height: 11px;
position: absolute;
margin: -20px 0 0 -15px;
z-index:-1; //Прячем элемент под родителя
}
div class="luchshee-title">Лучшее предложение</div>