W
W
WalkersRei2018-08-25 23:38:55
PHP
WalkersRei, 2018-08-25 23:38:55

How to add a range of digits to the database?

There was such question it is necessary to add a range of numbers to the database. For example, 41-44, then it is necessary that all the numbers from 41 to 44 be added to the database. I was looking for solutions, I did not find it on the Internet. And the methods that are available do not support PHP 5.6 and above.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mletov, 2018-08-25
@mletov

google->sql+generation of numerical sequence
PS And here PHP?

B
bkosun, 2018-08-26
@bkosun

Use the range function to create an array containing a range of elements.

// array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
foreach (range(0, 12) as $number) {
    echo $number;
}

php.net/manual/en/function.range.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question