简体   繁体   中英

Syntax error with session function on php5.3

The following function works on php 5.6 but gives error on php 5.3 which is the version of the cpanel im using. im unable to update the cpanel php version so i need to find a workaround..

 $url =isset($_SESSION['url']) ? $_SESSION['url'] : [];

the error is:

Parse error: syntax error, unexpected '[' in /home/mydomain/public_html/mypage.php on line 7

any workaround is appreciated, thanks in advance.

Use array() instead of []. Yeah, it's PHP, not JavaScript.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM