use better php string cast function (thanks @gonzaloserrano)