what is wrong with this javascript and php code
<p>I've been trying to debug this for an hour:</p>

<pre><code>&lt;script type="text/javascript"&gt;   
            function initialize() {     
                alert('test');
                var latlngarr = new Array();
                var titlearr = new Array();
                &lt;?php
                    echo "latlngarr.length=".$response-&gt;total.";";
                    echo "titlearr.length=".$response-&gt;total.";";
                    for ($i=0;$i&lt;$response-&gt;total;$i++){
                        echo "latlngarr[".$i."] = new google.maps.LatLng(".$response-&gt;businesses[$i]-&gt;location-&gt;coordinate-&gt;latitude.",".$response-&gt;businesses[$i]-&gt;location-&gt;coordinate-&gt;longitude.");";
                        echo "titlearr[".$i."] = \"".$response-&gt;businesses[$i]-&gt;name."\";";
                    }
                ?&gt;

                var myOptions = {       
                    zoom: 10,       
                    center: latlngarr[0],       
                    mapTypeId: google.maps.MapTypeId.ROADMAP     
                };     
                var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);   
                var markerarr = new Array(titlearr.length);
                for(var i=0;i&lt;markerarr.length;i++)
                    markerarr[i] = new google.maps.Marker({position: latlngarr[i], map: map, title:titlearr[i]});

            }  
        &lt;/script&gt; 

&lt;body onload="initialize()"&gt;
</code></pre>

<p>The error that I got is :</p>

<pre><code>Uncaught SyntaxError: Unexpected token &lt;
</code></pre>

<p>and</p>

<pre><code>Uncaught ReferenceError: initialize is not defined
</code></pre>

<p>when I remove that block of PHP code, it doesn't give me that error...why?</p>

<p><strong>UPDATE:</strong></p>

<p>Here's where the error is:</p>

<pre><code>$(".saved").live('click', function() {
                            var $btn = $(this);
                            $.post("update.php", {uid: my_uid, save: "no", mid: "&lt;?php echo $mid; ?&gt;"}, function(){
                                    setTimeout(function(){
                                       $btn.replaceWith('&lt;a class="save action_btn" onclick="return false;"&gt;Save&lt;/a&gt;');   
                                   }, 100); //this is line 76
                                }
                            );
                 });
</code></pre>

<p>Here's the generated JS from that initialize function:</p>

<pre><code>            function initialize() {     
                alert('test');
                var latlngarr = new Array();
                var titlearr = new Array();
                &lt;br /&gt;
&lt;font size='1'&gt;&lt;table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'&gt;
&lt;tr&gt;&lt;th align='left' bgcolor='#f57900' colspan="5"&gt;&lt;span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'&gt;( ! )&lt;/span&gt; Notice: Undefined property: stdClass::$total in C:\wamp\www\movie.php on line &lt;i&gt;89&lt;/i&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th align='left' bgcolor='#e9b96e' colspan='5'&gt;Call Stack&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th align='center' bgcolor='#eeeeec'&gt;#&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Time&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Memory&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Function&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Location&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;1&lt;/td&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;0.0009&lt;/td&gt;&lt;td bgcolor='#eeeeec' align='right'&gt;711160&lt;/td&gt;&lt;td bgcolor='#eeeeec'&gt;{main}(  )&lt;/td&gt;&lt;td title='C:\wamp\www\movie.php' bgcolor='#eeeeec'&gt;..\movie.php&lt;b&gt;:&lt;/b&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/font&gt;
latlngarr.length=;&lt;br /&gt;
&lt;font size='1'&gt;&lt;table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'&gt;
&lt;tr&gt;&lt;th align='left' bgcolor='#f57900' colspan="5"&gt;&lt;span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'&gt;( ! )&lt;/span&gt; Notice: Undefined property: stdClass::$total in C:\wamp\www\movie.php on line &lt;i&gt;90&lt;/i&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th align='left' bgcolor='#e9b96e' colspan='5'&gt;Call Stack&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th align='center' bgcolor='#eeeeec'&gt;#&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Time&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Memory&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Function&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Location&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;1&lt;/td&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;0.0009&lt;/td&gt;&lt;td bgcolor='#eeeeec' align='right'&gt;711160&lt;/td&gt;&lt;td bgcolor='#eeeeec'&gt;{main}(  )&lt;/td&gt;&lt;td title='C:\wamp\www\movie.php' bgcolor='#eeeeec'&gt;..\movie.php&lt;b&gt;:&lt;/b&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/font&gt;
titlearr.length=;&lt;br /&gt;
&lt;font size='1'&gt;&lt;table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'&gt;
&lt;tr&gt;&lt;th align='left' bgcolor='#f57900' colspan="5"&gt;&lt;span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'&gt;( ! )&lt;/span&gt; Notice: Undefined property: stdClass::$total in C:\wamp\www\movie.php on line &lt;i&gt;91&lt;/i&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th align='left' bgcolor='#e9b96e' colspan='5'&gt;Call Stack&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th align='center' bgcolor='#eeeeec'&gt;#&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Time&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Memory&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Function&lt;/th&gt;&lt;th align='left' bgcolor='#eeeeec'&gt;Location&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;1&lt;/td&gt;&lt;td bgcolor='#eeeeec' align='center'&gt;0.0009&lt;/td&gt;&lt;td bgcolor='#eeeeec' align='right'&gt;711160&lt;/td&gt;&lt;td bgcolor='#eeeeec'&gt;{main}(  )&lt;/td&gt;&lt;td title='C:\wamp\www\movie.php' bgcolor='#eeeeec'&gt;..\movie.php&lt;b&gt;:&lt;/b&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/font&gt;

                var myOptions = {       
                    zoom: 10,       
                    center: latlngarr[0],       
                    mapTypeId: google.maps.MapTypeId.ROADMAP     
                };     
                var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);   
                var markerarr = new Array(titlearr.length);
                for(var i=0;i&lt;markerarr.length;i++)
                    markerarr[i] = new google.maps.Marker({position: latlngarr[i], map: map, title:titlearr[i]});

            }  
</code></pre>
