2014-10-27 adapted for php 5.3