Smells Of Code Series - PHP If condition
— smells of code — 1 min read
This my first code smell, a basic one. A friend asks me to have a look and integrate a 3rd-party service on his PHP website. He initially hired a freelance developer through a freelance platform to build his website but we all know the costs of maintenance. I found some good things like well design SQL queries but the website architecture was very bad. This code block was funny though 😄
if (strpos($key, "contact-form-") === false) {}else { ...}
For readability I think you should switch the if condition..
if (strpos($key, "contact-form-") !== false) { ...}
Go to: Previous Code Smell
Thanks for reading my article. I am Roberto and I'm based in Madeira Island, Portugal. Get in touch via @RobertoRJ or email me at em.susejotrebor@tniopyrtne