K
K
kakoringroup2017-08-25 10:34:04
PHP
kakoringroup, 2017-08-25 10:34:04

How to find only paired phone numbers in an array?

There is an array

$row_numbers=array(1234444,2223333,2233333,4443333,1234445,2234444,1234447);

, about 20k phone numbers, you need to create a new array with numbers that differ from each other by only 1 digit in the same position.
For example, the final array for the arrays above should be:
$new_array_numbers=array(1=>array(1234444,1234445,1234447),2=>array(2223333,2233333),3=>array(2234444,1234444));

1st element turned out because all the numbers in it differ only by the last digit,
2nd element turned out because all the numbers in it differ by the 3rd digit
3rd element turned out because all the numbers in it differ by the 1st digit

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2017-08-25
@dimonchik2013

1) permutations
2) checking in an array

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question