$v) { // Loop through numbers if ((preg_match('/[90]/',$v) === 0) && (array_sum(str_split($v, 1)) === 10)) { // If number does not contain 8,9 or 0 and sum of all 4 numbers is 10 // Apply function to multiply each number by 10 and add to result array $result[] = array_map("magnitude", str_split($v, 1)); } } function magnitude($val) { // function to multiply by 10 for array map return($val * 10); }