Hi.

I need to see if a variable exists, I guess using isset($var) somehow. My problem is that the variable name to check it against is from an array. So how do I reference the name of a variable from an array? It can't be:
if (isset($array[$i]))

because that would check the existence of the contents of the array.

Help appreciated,

BS

    if (isset(${$array[$i]}))
    {

    yes it exists

    };

      • [deleted]

      No, but it helps for readability

        • [deleted]

        True, the notation with {} is just a little clearer, allmost like arrays 🙂

          So your saying that this code is not reliable

          if(1) {
          print("1");
          }

            Maybe this would be more reliable

            if(1) {
            print("1");
            };;;;;;;;;;;;;;;;;;;;;;;

              Hey mister Neuromancer,
              how about READING a post before you reply?

              I said it helps for READABILITY, not RELIABILITY.

                Write a Reply...