how to add a javascript code correctly within a php code? I tried to do this with the code below, but I get the error:
Parse error: syntax error, unexpected 'text' (T_STRING), expecting ',' or ';'
<?php
$myImagesList = array (
'image1.png' ,
'image2.png' ,
'image3.png' 
);
shuffle ($myImagesList);
echo '<div style = "background: #0600ff" class = "div02">';
for ($i=0; $i<5; $i++) {
    if ($i < 5) {
        echo '' . $myImagesList[$i] . '';
    }
    if ($i == 5) {
       echo '</div>';
       echo ' <script type='text/javascript'>
var cpmstar_pid = 45265;
document.writeln('<SCR' + 'IPT language='Javascript' src='' + (document.location.protocol=='https:'?'//server':'//cdn') + '.cpmstar.com/cached/js/feedback_v101.pack.js'></SCR' + 'IPT>');
</script> ';
        echo '<div style = "background: #0600ff" class = "div02">';
     }  
     if ($i > 5) {
        echo '' . $myImagesList[$i] . '';
      }
  }
 echo '</div>';
?>
 
    