Sunday, 24 September 2017

php - Parse error: syntax error, unexpected ']'

I'm getting this error:




Parse error: syntax error, unexpected ']', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in your code on line 70




Line 70 is $message.



$random_keys=array_rand($lel,1);
$message[] = $lel[$random_keys[0]];



The whole code is here:



$message = array(); 
$lel = array(
'Are you sure its the new year?',
'And i thought i was dumb', 'its not new year yet',
'LOL its ${date}', '...', '.....', '...', 'WUT', '.......',
'Ya drunk bruh ?', 'You sure you are not drunk ? what is 1+1 then ?'

);
$random_keys=array_rand($lel,1);
$message[] = $lel[$random_keys[0]];


Can we do it like this?



$message[] = $lel[rand(1,11)];



It still gives:




Parse error: syntax error, unexpected ']', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...