I made a PHP page with an array using the following syntax:
$Legenda = [
"Cores" => ["#FF0000", "#FFA500", "#FFFF00", "#64FF00", "#00AA00", "#005500", "#0000FF"],
"ValMinimos" => [50, 62.85714, 75.71429, 88.57143, 101.42857, 114.28571, 127.12286],
"ValMaximos" => [62.85714, 75.71429, 88.57143, 101.42857, 114.28571, 127.12286, 140]
];
which works fine on windows (PHP 5.4.6, installed using EasyPHP), but when I uploaded the same page to a Ubuntu Server (PHP 5.3.10, installed using apt-get from repositories), I get an error: "Parse error: syntax error, unexpected '[' in /var/www/ShapeTest_server_get_dados.php on line 13". Line 13 is the $Legenda array definition.
It's been a while since I programmed with PHP, but as I remember that syntax was valid. Is this an option turned off by default on linux, or why doesn't this work?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…