<!DOCTYPE html>
<html>
<body>
<?php
$array=array(1,2,3);
?>
<script>
let i =0;
let y= "<?php echo $array[i] ?>";
document.write(y);
</script>
</body>
</html>
It works and print the value in array if i write $array[0] but it doesnt work or prints nothing if i say $array[i] which btw i is 0 so why?