3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "Seats: 11;12; Name: qqqq;wwww; Start: Прешов, АВ Košická 2725/2 End: Мукачево, АЗ Лавковская, 1б Date: 2019-06-22 Time: 09:40 PM"; $lines = explode("\n", trim($str)); $data = array_reduce($lines, function($res, $line){ [$key, $value] = preg_split('#\s*:\s*#', $line, 2); $res[$key] = $value; return $res; }, []); var_dump($data); preg_match_all('#(\d+);#', $data['Seats'], $m); var_dump($m[1]);
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.26, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
array(6) { ["Seats"]=> string(6) "11;12;" ["Name"]=> string(10) "qqqq;wwww;" ["Start"]=> string(35) "Прешов, АВ Košická 2725/2" ["End"]=> string(48) "Мукачево, АЗ Лавковская, 1б" ["Date"]=> string(10) "2019-06-22" ["Time"]=> string(8) "09:40 PM" } array(2) { [0]=> string(2) "11" [1]=> string(2) "12" }