'pre_command' functionality added

- 'pre_command' functionality added
- tested script on php 5.3 and 5.4