You can't do that. You need to do an AJAX call to a PHP page that would generate this array. So you need 2 separate pages. Here is an example on how you can do that.
The HTML / Javascript page:
Code:
<html>
<head>
<title>jQuery UI autocomplete</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
</head>
<body>
<script type="text/javascript">
$.getJSON("test.php", function(data) {
$( "#tags" ).autocomplete({
source: data
});
});
</script>
<input id="tags" />
</body>
</html>
The PHP page (test.php):
PHP Code:
<?php
echo json_encode(array("ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"));
?>
This is a way... using some JSON output and the built-in getJSON jQuery function.
But the autocomplete function has a built-in way to query a php page. Please check this:
http://jqueryui.com/demos/autocomplete/#remote