The reason the examples appear longer is because the website is documenting how to implement PHP functions in Python. Since Python is not PHP, it won't implement line-for-line replacement functions.