The Pineco.de blog has a post sharing some little snippets of code that can help to keep things cleaner and perform some common operations.
Sometimes it’s harder to keep your code clean and readable than to implement some architecture in your application. We collected some snippets that may help you to refactor your code.
Their list includes code to help with:
- array casting
- type checking
- removing unnecessary "if" statements
They also have several others for different languages on the snippets page of their site for Javascript, Laravel, WordPress and even an .htaccess configuration.