How to set NULL if REGEX doesn't has any matches?
<p>I have a regex which returns just numbers from string:</p>

<pre><code>$str  = "this is 1 str, 2";
$numb = preg_replace("/[^0-9]/","",$str);
echo $numb; // output: 12
</code></pre>

<p>But if string doesn't be containing number, then it will return nothing. Now I want it returns <code>NULL</code> if string isn't containing number. Something like this:</p>

<pre><code>$str  = "this is one str";
$numb = preg_replace("/[^0-9]/","",$str);
echo $numb; // current output:
            // what I want: null
</code></pre>

<p><strong>Note:</strong> That <code>null</code> isn't a string, it should be something like this: <code>$numb = null;</code></p>

<p>How can I do that?</p>