Bored convert from Python to PHP