title: Undefined variable problem with PHP function
body: <p>I'm a PHP newbie, so I have a minor problem functions.
  I have this line of code:</p>
  
  <pre><code>&lt;?php
  $ime=$_POST["ime"];
  $prezime=$_POST["prezime"];
  $pera="string";
  if (empty($ime)||empty($prezime)){
      echo "Ne radi, vrati se nazad i unesi nesto!";
  }
  function provera($prom){
      if (preg_match("/[0-9\,\.\?\&gt;\.&lt;\"\'\:\;\[\]\}\{\/\!\\\@\#\$\%\^\&amp;\*\(\)\-\_\=\+\`[:space:]]/",$prom)){
          echo "Nepravilan unos imena ili prezimina!";
          echo $pera;
          }
  }
  provera($ime);
  provera($prezime);
  ?&gt;
  </code></pre>
  
  <p>Anyway, when I try this code I always get an error message saying that there's a error on on line 11 (the bold part of the code) and no variable is echoed. I'm guessing that it gives me that error because my variable isn't defined inside of that function, but I need to define it outside of the function so is there a way to do this?</p>