3v4l.org

run code in 300+ PHP versions simultaneously
<?php $single_chart = [ '128', '129', '120', '130', '140', '123', '124', '125', '126', '127', '137', '138', '139', '149', '159', '150', '160', '134', '135', '136', '146', '147', '148', '158', '168', '169', '179', '170', '180', '145', '236', '156', '157', '167', '230', '178', '250', '189', '234', '190', '245', '237', '238', '239', '249', '240', '269', '260', '270', '235', '290', '246', '247', '248', '258', '259', '278', '279', '289', '280', '380', '345', '256', '257', '267', '268', '340', '350', '360', '370', '470', '390', '346', '347', '348', '358', '359', '369', '379', '389', '489', '480', '490', '356', '357', '349', '368', '378', '450', '460', '579', '570', '580', '590', '456', '367', '458', '459', '469', '479', '560', '589', '670', '680', '690', '457', '467', '468', '478', '569', '678', '679', '689', '789', '780', '790', '890', '567', '568', '578']; $double_chart = [ '100', '110', '166', '112', '113', '114', '115', '116', '117', '118', '119', '200', '229', '220', '122', '277', '133', '224', '144', '226', '155', '228', '300', '266', '177', '330', '188', '233', '199', '244', '227', '255', '337', '338', '339', '448', '223', '288', '225', '299', '335', '336', '355', '400', '366', '466', '377', '440', '388', '334', '344', '499', '445', '446', '447', '556', '449', '477', '559', '488', '399', '660', '599', '455', '500', '600', '557', '558', '577', '550', '588', '688', '779', '699', '799', '880', '566', '800', '667', '668', '669', '778', '788', '770', '889', '899', '700', '990', '900', '677']; $digits = '235046'; $single_chart_filtered = []; foreach($single_chart as $chart_value){ if(preg_match("/^[$digits]+$/",$chart_value) === 1){ $single_chart_filtered[] = $chart_value; } } print_r($single_chart_filtered); $double_chart_filtered = []; foreach($double_chart as $chart_value){ if(preg_match("/^[$digits]+$/",$chart_value) === 1){ $double_chart_filtered[] = $chart_value; } } print_r($double_chart_filtered);
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.24, 7.4.0 - 7.4.13, 8.0.0
Array ( [0] => 236 [1] => 230 [2] => 250 [3] => 234 [4] => 245 [5] => 240 [6] => 260 [7] => 235 [8] => 246 [9] => 345 [10] => 256 [11] => 340 [12] => 350 [13] => 360 [14] => 346 [15] => 356 [16] => 450 [17] => 460 [18] => 456 [19] => 560 ) Array ( [0] => 200 [1] => 220 [2] => 224 [3] => 226 [4] => 300 [5] => 266 [6] => 330 [7] => 233 [8] => 244 [9] => 255 [10] => 223 [11] => 225 [12] => 335 [13] => 336 [14] => 355 [15] => 400 [16] => 366 [17] => 466 [18] => 440 [19] => 334 [20] => 344 [21] => 445 [22] => 446 [23] => 556 [24] => 660 [25] => 455 [26] => 500 [27] => 600 [28] => 550 [29] => 566 )