IsDefined() vs. structKeyExists()

By Eric Jones
We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now

Sean Corfield recently blogged about the choice to use IsDefined vs. structKeyExists when trying to determine if a scoped variable (session, application, request, form url etc), exists or not.

Sean talks about how certain dot noted variables will or won’t be seen with IsDefined, BUT I found the fact that IsDefined looks for ANY possible definition even when the variable you’re searching for has been scoped.

Read his blurb to get the full effect.

We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now
  • The first paragraph is an incomplete sentence… *what* are you trying to determine?!

  • jonese

    fixed sorry about that, must have gotten lost in my cut / paste.

Recommended
Sponsors
Get the latest in Front-end, once a week, for free.