Home Forums Feedback if($var)… vs. if(isset($var))…


if($var)… vs. if(isset($var))…

  • Hi Elliot,

    just have a general coding question. I made several own field types, where i include your pro field types repeater and flexible field. i made this to have an easier configuration of the fields.

    if i turn on error reporting i recognize a lot of missing array values. so i looked into your coding and recognized lines like:

    if( $field['collapsed'] ) {

    isn’t it better to do like:

    if( isset( $field['collapsed'] ) ) {


  • Is this still happening with the latest version of ACF?

    The fist one that is used in ACF assumes that the index is set, which I think is should be because I think ACF sets default values where they aren’t set, but I could be wrong, I’m not the developer.

    It could be something that has been overlooked, the collapsing feature is recently added.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘if($var)… vs. if(isset($var))…’ is closed to new replies.