title: function to check if value exists - php
body: <p>I was wondering if it is possible to have a general system function that checks for a value and if it doesn't exist return another value.</p>
  
  <p>below is what I have come up with however if I use it on a value say $thisvalue but $thisvalue doesn't exist I am getting the error Undefined variable: thisvalue. If thisvalue is empty or null etc below works.</p>
  
  <p>Thanks</p>
  
  <pre><code>public function checkingValue($value = NULL, $empty_return = NULL)
  {
      if(isset($value))
      {
          return $value;
      }
      else
      {
          return $empty_return;
      }
      if(!empty($value))
      {
          return $value;
      }
      if(!is_null($value))
      {
          return $value;
      }
  
      return $empty_return;
  }
  </code></pre>