PHP Strict Types
PHP gets enough flack for being insecure and untamed. Moving toward stronger security and stricter coding is one of the benefits of PHP 7+
The short answer is you should pretty much always use
strict_types whenever possible, these days. However, if you’re upgrading old code, you of course need to be sure that everything works correctly after adding
strict_types, because the PHP engine will interpret it more strictly.
It is also worth nothing that current implementation is not very aggressive, so you can still include PHP files (etc) in other files, and it will not necessarily break them if their code does not follow same type suit.
And yes, you have to declare it at the top of every single script 🙂
Recent Blog Posts
The Last (Lightweight) CSS Reset You’ll Need
CSS resets have always been a pain in the neck, because of new elements and CSS options being released every few years. To make it more annoying, various browsers have decided to come up with their own default CSS settings in case they are undefined (and sometimes, even if they are defined). Since our team […]
Custom Cron Jobs (Unrestricted Code) Are Here
One of the most requested features ever, custom cron jobs, is finally here! A lot of developers who have come across SlickStack always say “this is awesome and super optimized but I still need the ability to add a few custom cron jobs” for a special API to import their WooCommerce products, or a third […]
Fastest WordPress Hosting (For Under $5/mo)
For over a decade, WordPress has continued to dominate the web hosting industry as small businesses and bloggers alike continue to seek out free and reliable CMS software that can easily be moved between web servers as needed, without being locked-in to any single platform or service. But in the past few years especially, high-tech […]