PHP 5.3.10和PHP 5.3.29之间的代码差异[重复]

This question already has an answer here:

I need to make an HTTP call from a PHP script. I've tested it on my personal domain (running PHP 5.3.29) and it's all ok. When I've moved it on my customer domain (running PHP 5.3.10) the script starts having some problem.

In particular, this is the code that generate the error:

function BuildPlayFabHttpHeaders($i_PlayFabSecretKey) {

    $headers = [
        "Content-Type: application/json",
        "X-SecretKey: $i_PlayFabSecretKey"
    ];

    return $headers;
}

I think the problem is with that kind of declaration, but I'm not a php expert. Can anyone help me to get this running on PHP 5.3.10?

</div>

This wouldn't have worked on PHP 5.3.29 since the short array syntax [..] was introduced in PHP 5.4.

For anything under 5.4, you must use:

array(
    key  => value,
    key2 => value2,
    key3 => value3,
    ...
)

My assumption is your tests weren't actually using the PHP 5.3.29 binary but some other version installed on the system.