Python similar functions in the PHP