PHP Classes

A tip for #2

Recommend this page to a friend!

      PHP Classes blog  >  Top 10 PHP Tips Every...  >  All threads  >  A tip for #2  >  (Un) Subscribe thread alerts  
Subject:A tip for #2
Summary:Yoda style can be useful sometimes
Author:Filip Komar
Date:2015-08-04 09:49:00
Update:2015-08-04 15:16:52

  1. A tip for #2   Reply   Report abuse  
Picture of Filip Komar Filip Komar - 2015-08-04 15:16:52
I do forget to use == here and there so I use the following tip as such error is sometimes tricky to debug.

Yoda style is not clean but still useful for #2:
if(CONSTANT = $variable) will throw an error while
if($variable = CONSTANT) will not so it can easily be overlooked.