R
R
Roman Hinex2015-03-31 22:29:26
PHP
Roman Hinex, 2015-03-31 22:29:26

[PHP] How to generate alphabet for different languages?

It is necessary to display the alphabets of different languages ​​in the correct sequence. There is a working code for Russian and English. Can you suggest something similar for German, Italian, French and any others?
English:

foreach(range('a','z') as $a) {
    echo $a;
}

Russian:
for ($i = 224; $i <= 255; $i++) {
    echo iconv('CP1251', 'UTF-8', chr($i));
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
olamedia., 2015-03-31
@HiNeX

$alphabet = "abc....xyz";
foreach (preg_split('//u', $alphabet, -1, PREG_SPLIT_NO_EMPTY) as $char){
    echo $char;
}

looking for sequences in utf-8 is a bad job. also good luck with japanese

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question