PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $periodText = '[PERIOD_TEXT] => от 2 до 57 дней <span'; preg_match_all('~\d+~', $periodText, $matches); $numbers = array_map('intval', $matches[0]); $deliveryPeriod = []; if (count($numbers) === 1) { $deliveryPeriod[] = $numbers[0]; } elseif (count($numbers) === 2) { $deliveryPeriod[] = $numbers[0]. "-"; $deliveryPeriod[] = $numbers[1]; } print(implode($deliveryPeriod)); ?>
Show:  
Copy Clear