CakePHP Tips Winter 2016

2

This is literally my last blog post for the year 2016 🙂 Use the right DateTime typehint If you are passing DateTime objects around in CakePHP, they are usually Chronos objects, and either \Cake\I18n\Time or \Cake\I18n\FrozenTime then. Both those are…

Emoji and CakePHP

0

You might think: Why do I care. Well, you would be surprised – but pretty much any website with at least one form on the page will be affected here. So anyone with even just a basic contact form should…

CakePHP Tips Fall 2016

0

Always use proper version check method Be aware of version checks that are using the inferior and even wrong </> comparison. This can lead to wrong conditions with higher minor versions. I had this in my code from the early…

PHP

Chronos – Let there be time

0

In PHP most know of DateTime class to handle date and time. At least with more modern PHP versions it is now not advised anymore to use the plain old date() and time() functions. The use cases – especially with…

PHP

Use isset() and empty() wisely

0

This is another part of the series "How to write better PHP code". Sometimes it is the small things than can make all the difference. In this case simply using the correct way of checking for variable content can avoid…