dimanche 26 avril 2015

Brackets and Arrays in PHP

Running this on a localhost, everything ran fine. Now, when running it on a web server, I'm getting parse errors regarding the [] in the first line. Is this not a legitimate way to declare an array in PHP?

function render($template, $values = [])
{
    // if template exists, render it
    if (file_exists("../templates/$template"))
    {
        // extract variables into local scope
        extract($values);
        // render template
        require("../templates/$template");
    }




Aucun commentaire:

Enregistrer un commentaire