drop unused print_r() function
String.endsWith isn't used anywhere
update minimum required PHP version
drop pre-php5.3 implementation of json_encode()