3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _ts_restrictions_translate_ws_message($message = '') { $source = array( 'The maximum quantity allowed for (\w+) title groups is (\d+) per two-year cycle.', 'The maximum allotment of licenses for this (\w+) title group is (\d+) per two-year cycle.', 'The maximum quantity allowed for (\w+) server products is (\d+) per two-year cycle.', 'Your organization has already requested Get Genuine Full Windows operating system products. This is a one-time-only donation.', 'Get Genuine Windows full operating system requests are subject to a unique approval process, so you cannot combine them with any other products in a single cart. Please remove these products from your cart and complete the check-out process for the remaining products. Then place a second request for the Get Genuine Windows full operating systems.', 'You cannot combine products from the main Microsoft Donations Program with products from the Microsoft Direct Donations Program in a single cart.', 'You must order a minimum of (\d+) seats for (\w+) product orders.', 'You can order a maximum of (\d+) (\w+) items in (\w+). You have already ordered $annualOrdered and can not order any more.', 'You can order a maximum of (\d+) (\w+) items in (\w+). You have already ordered $annualOrdered and can only order (\d+) more.', 'You can order a maximum of (\d+) (\w+) title (\w+) in a fiscal year. You have already ordered (\d+) and can not order any more.', 'You can order a maximum of (\d+) (\w+) title (\w+) in a fiscal year. You have already ordered (\d+) and can only order (\d+) more.', 'There is a limit on the number of times you may request this (\w+) product. The quantity in your cart of product (\w+) exceeds the maximum number of allowable requests.', ); $matches = array(); foreach ($source as $pattern){ if(preg_match('/'.$pattern.'/', $message, $matches)){ break; } } die(var_dump($matches)); } _ts_restrictions_translate_ws_message('The maximum quantity allowed for Microsoft title groups is 10 per two-year cycle.');
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
array(3) { [0]=> string(81) "The maximum quantity allowed for Microsoft title groups is 10 per two-year cycle." [1]=> string(9) "Microsoft" [2]=> string(2) "10" }

preferences:
196.47 ms | 404 KiB | 254 Q