title: if ( isset inside a function for loops
body: <p>I'm try to write a custom function trying to avoid to rewrite the if(isset everytime I call an array in a loop:</p>
  
  <pre><code>function ifvalueexists($valueexists){
  if(isset ($valueexists ) ){
      $newvalue = $valueexists;
      return $newvalue;
      }
  else {
       $newvalue = '';
       }
       return $newvalue;  
  }
  </code></pre>
  
  <p>TEST:</p>
  
  <pre><code>$myarray = array(1, 2, 3);
  
  for ($i = 0; $i &lt; 5; ++$i){
      echo ifvalueexists($myarray[$i]);
  }
  </code></pre>
  
  <p>but I still get: Undefined offset: 3  and Undefined offset: 4. What am I doing wrong? Thanks! </p>