Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
You can use less commands when making sure $char is not more than 255. Just use $char = ++$char % 256; -- this way it is shorter, cleaner and is only one command instead of if/else. Just an advice.
This is not real-world programming, so no need to check if the variable is empty or null. I don't understand why do people often do this in problems, I mean it is certain there won't be any error in input data, unless it is specified in the task. Remove this check and you have a lot shorter, cleaner and better solution. I didn't mean to abuse you, it's just a shout-out to everybody who does it.