how to put comma in every 3 digit for a number
<p>I want to put comma in every 3 digit for a number, for example.</p>

<pre><code>$number = 1234567;
// should print 1,234,567
</code></pre>

<p>how can I do this?</p>

<p><strong>update: please see this code</strong></p>

<pre><code>&lt;?php
/**
 * Get Popularity Text of a Domain via Alexa XML Data
 *
 * @return string|FALSE text or FALSE on error
 */
function alexa_get_rank($domain)
{
    $alexa = "http://data.alexa.com/data?cli=10&amp;dat=s&amp;url=%s";
    $request_url =  sprintf($alexa, urlencode($domain));


    $xml = simplexml_load_file($request_url);
    if (!$xml) {
        return FALSE;
    }

    $nodeAttributes = $xml-&gt;SD[1]-&gt;POPULARITY-&gt;attributes();
    $text = (int) $nodeAttributes['TEXT'];

    $num = number_format($text);

    return $num;
}
</code></pre>

<p><strong>in this return only 3 digit.</strong></p>
