呵呵,刚刚给你写了一个,不知道是不是你像要的?
<html> 
<head> 
<title>Open Window </title>
<?php
error_reporting(0);
$text=array("nihao","xiexie","你好","谢谢");
for($i=0;$i<count($text);$i++)
{
$text_str.=$text[$i].",";
}
?><script language="JavaScript">
OpenWindow('<?php echo $text_str; ?>');
function OpenWindow(text) 

var arr = text.split(',');
alert("整个字符串的值:"+arr);
for(var i=0;i<(arr.length)-1;i++)
{
alert("值 "+i+" :"+arr[i]);
}

</script> 
</head> 
<body>