This is just for fun.
I'm playing a game where you type A-z as fast as you can, I can't do it faster than in 5 seconds and I think it may be humanly impossible to do it in 1-2 seconds. However, it may be possible to create a small program in Java or Php which, when started, sends the inputs of letter keys A-z to the computer as fast as possible.
How can this be done in either Java or php?
I realise this isn't a solution in the programming languages you want, but for other searchers the open source software AutoKey is perfect for this kind of thing - automating key presses/mouse movements to perform repetitive tasks.
If the target game is in Java, you could use the Robot class to send keystrokes to the application. Other than that, there are platform dependent ways to send keystrokes to a different application. On windows, you can use the SendMessage() command with WM_KEY to emulate keystrokes (through JNA for example).