mardi 7 juillet 2015

Confusing if statement in php

I'm refreshing some older code (someone else wrote), and came across this:

if ( empty ( $role_data["role_id" == 1]))

what are the reasons (if any) one would use the above instead of?:

if ( $role_data["role_id"] != 1)

IMO readability is worse and it's more code. Performance isn't a factor here.

Aucun commentaire:

Enregistrer un commentaire