I noticed there is two different behaviors in PHP when we increment the alphabet:
Range:
range('a', 'Z');
output:
["a","`", "_", "^", "]","\", "[","Z"]
Which correspond to the ASCII table and make sense to me.
But when we increment with a for loop:
$letters = [];
for($i = 'a'; $i !== 'Z'; $i++){
$letters[] = $i;
}
output:
[ "a", "b", "c", "d", ..., "x", "y", "z", "aa", "ab", "ac", "ad", "ae", "af", ...]
Why is php suddenly stuck with the letters 'a-z' instead of using the ASCII table?
And how does work the range method for not using this behavior?