Advertisement
salmancreation

Incrementing string - char letter for loop

Aug 1st, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.34 KB | None | 0 0
  1. You can do it with the ++ operator.
  2.  
  3. $i = 'aaz';
  4. $i++;
  5. print $i;
  6. aba
  7.  
  8. However this implementation has some strange things:
  9.  
  10. for($i = 'a'; $i < 'z'; $i++) print "$i ";
  11. This will print out letters from a to y.
  12.  
  13. for($i = 'a'; $i <= 'z'; $i++) print "$i ";
  14. This will print out lettes from a to z and it continues with aa and ends with yz.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement