Fill a JS snippet with PHP
<p>How can I input results of a PHP array inside a JS-file?</p>

<p>I have this PHP-snippet which returns an Array:</p>

<pre><code>$activiteiten = Project::getProjectnames($_DB);
if(!empty($activiteiten)) {
    foreach($activiteiten as $k =&gt; $v) {
        $projectNames[] = $v['project'];
    }
}
</code></pre>

<p>How can I get these values inside this JS:</p>

<pre><code>&lt;script&gt;
    $(function() {
        var availableTags = [
            "Option 1",
            "Option 2",
            "Option 3",
            "Option 4"
        ];
        $( "#tags" ).autocomplete({
            source: availableTags
        });
    });
&lt;/script&gt;
</code></pre>

<p>I want the PHP array in stead of the <code>Option 1</code>, <code>Option 2</code>, <code>Option 3</code>,... But how do I do this?</p>

<p>I'm generating the JS by using a PHP <code>echo</code>-call. </p>
