Php validate with preg_match
<p>I try to validate fields. Three fields that may only contain numbers. The fields have the variable names $num1, $num2, $num3. I have put them in an array and then I run preg_match but it does not work. How should I do?</p>

<pre><code>$valnum = array (‘$num1’, ‘$num2’, ‘$num3’);
    if (preg_match('/[0-9]/', $valnum)){
echo $mycost;
}
    else {
echo 'You can only enter numbers';  
    }
</code></pre>
