0
Need to make a form select of A-Z, how can I do this without being manually? In this case, I would do it manually as follows:
<select>
<option>A</option>
<option>B</option>
<option>Z</option>
</select>
0
Need to make a form select of A-Z, how can I do this without being manually? In this case, I would do it manually as follows:
<select>
<option>A</option>
<option>B</option>
<option>Z</option>
</select>
6
Here’s hoping you can help him:
foreach (range('A', 'Z') as $char) {
echo $char . "\n";
}
1
Just to complement the answer from life.cpp
A good alternative is to use foreach. But how to do a repeat if foreach works with an existing array?
PHP provides us with the function range()
that creates an array according to the parameters defined by nodes.
range ( "inicio" , "fim" [, N ] )
, where N, optional, is a number that defines the number of steps. If omitted is set to 1, that is, all elements will be listed.
Example 1 - : $y = range("a", "z");
see in ideone
Example 2 - : $y = range("a", "z" , 2);
see in ideone
Another way is according this example in ideone
Browser other questions tagged php
You are not signed in. Login or sign up in order to post.
I didn’t understand why they denied me, it was my question and his answer was exact!
– Sr. André Baill
Relacioanda: Increment letters in PHP?
– rray