Interesting output in a simple PHP webpage
<p>Here is a very simple PHP page with one javascript function in it. I am seeing the output differently. I am not able to understand why is it behaving that way.</p>

<p>In the code below, x echoes as 012012, but when I pass it into a javascript function and display it in an innerHTML, it displays differently as 5130 ??!!</p>

<p>Can anyone help ?</p>

<pre><code>&lt;?php
    $x= date("mY");
    echo $x;
?&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;script&gt;
            function myfunc1(y)
            {
                div1 = document.getElementById("mydiv1")
                div1.innerHTML = y;
            }
        &lt;/script&gt;
    &lt;/head&gt;
    &lt;body &lt;?php echo "onload='myfunc1(".$x.")'&gt;";?&gt;
    &lt;div id="mydiv1" style="background:#efefef;border:1px solid green;height:100px;width:100px;text-align:center"&gt;
    &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>HTML output</p>

<pre><code>012012&lt;html&gt;
    &lt;head&gt;
        &lt;script&gt;
            function myfunc1(y)
            {
                div1 = document.getElementById("mydiv1")
                div1.innerHTML = y;
            }
        &lt;/script&gt;
    &lt;/head&gt;
    &lt;body onload='myfunc1(012012)'&gt;    &lt;div id="mydiv1" style="background:#efefef;border:1px solid green;height:100px;width:100px;text-align:center"&gt;
    &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>HTML output (screenshot)
<img src="http://i.stack.imgur.com/xkRrH.png" alt="Screenshot"></p>
