$text = 'ClothArmor51Mag_1';
preg_match_all("/[A-Z][^A-Z]*?/Us", '$text', $output_array);
print_r($output_array);
$total = WC()->cart->get_cart_subtotal();
$min = 1500;
$difference = $min - intval($total);
if ($difference <= 0) {
echo "Доставка бесплатная";
} else {
echo "Для бесплатной доставки пополните корзину на $difference";
}
$els = array(
array('id'=> 1,'chance' => 10),
array('id'=> 2,'chance' => 15),
array('id'=> 3,'chance' => 1),
array('id'=> 4,'chance' => 20),
array('id'=> 5,'chance' => 50),
);
function getItem($data) {
$randArray = array();
foreach ($data as $value) {
for ($i = 0; $i < $value['chance']; $i++) {
$randArray[] = $value['id'];
}
}
return $randArray[mt_rand(0, count($randArray) - 1)];
}
$data = array(
'Lorem',
array(
'Lorem',
'ipsum',
'dolor',
),
'sit',
'amet',
array(
'consectetur',
'adipisicing',
'elit',
'Lorem',
),
);
function removeItems($data, $search) {
foreach ($data as $key => $value) {
if ( is_array($value) ) {
$data[$key] = removeItems($value, $search);
} else {
if (strpos($value, $search) !== false) {
unset($data[$key]);
}
}
}
return $data;
}
print_r(removeItems($data, 'Lorem'));