PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
What I'm trying to do is list an array of strings alphabetically -
I check the letter of the alphabet I'm on against the string's first character, at least that's what worked in English.
How can I get the whole 'first character' of the string so I can use it in an if() ?
In that case you have to extract the entire unicode character code (or 'codepoint') of the first character, which may consist of multiple bytes.
But it's not trivial how you want to sort this. For example, what do you consider to be the correct alphabetical order of these characters?
и (Russian) , 剑 (Chinese) , ij (Dutch) , ह (Hindi) , א (Hebrew) , ∫ (Math)
(in case your browser doesn't show this correctly, I mean these characters)
I guess there are plenty of example functions or libraries out there that can do so, for example "UTF-8 to Code Point Array Converter" seems to do just that.