Jump to content

Parse error: syntax error, unexpected '[


Go to solution Solved by Digitizer,

Recommended Posts

Config file ->          http://pastebin.com/aFVPZtQR   <--- The one i have the Syntax errors from

 

Index ->                  http://pastebin.com/nYpfb2zW   <--- So far no errors

 

I have no clue at all, any help? :) This is not my code, i just edit it. Im not really good at PHP you can say... :3

Edited by Stanley1212
Link to comment
https://forums.phpfreaks.com/topic/290765-parse-error-syntax-error-unexpected/
Share on other sites

You do the admin arrays very well, then on the rules arrays you switch to another "technique" which probably does give you the error.

 

Assign the values the way you did before and all should run fine.

$rules_column1 = [
    "No prop pushing, or prop killing", "No building in the Skybox",
    "No prop spamming", "No thruster or turret noises" ];


// What shall work

$rules_column1 = array(
"No prop pushing, or prop killing",
"No building in the Skybox",
"No prop spamming",
"No thruster or turret noises"
);

Edit: Too many quotes have been used :P

Edited by lawless

You do the admin arrays very well, then on the rules arrays you switch to another "technique" which probably does give you the error.

 

Assign the values the way you did before and all should run fine.

$rules_column1 = [
    "No prop pushing, or prop killing", "No building in the Skybox",
    "No prop spamming", "No thruster or turret noises" ];


// What shall work

$rules_column1 = array(
"No prop pushing, or prop killing",
"No building in the Skybox",
"No prop spamming",
"No thruster or turret noises"
);

Well, I did that 

 

$rules_column1 = array("
"No prop pushing, or prop killing",
"No building in the Skybox",
"No prop spamming",
"No thruster or turret noises");
 
$rules_column2 = array("
    "Do not blow up other players props on purpose",
    "Respect all players, not only admins",
    "No asking for ranks, we will give ranks when we feel like it");
 
$rules_column3 = array("
    "Do not kill people who are building on purpose",
    "Do not kill in God or in Noclip",
    "Do not Spawnkill, it is annoying and people will have temper issues",
    "Have a flawless experience");
 
?>
 
But now I get an diffrent syntax error  "syntax error unexpected 'No' (T_STRING)expecting')' on ---> "No prop pushing, or prop killing",

 

You do the admin arrays very well, then on the rules arrays you switch to another "technique" which probably does give you the error.

 

Assign the values the way you did before and all should run fine.

$rules_column1 = [
    "No prop pushing, or prop killing", "No building in the Skybox",
    "No prop spamming", "No thruster or turret noises" ];


// What shall work

$rules_column1 = array(
"No prop pushing, or prop killing",
"No building in the Skybox",
"No prop spamming",
"No thruster or turret noises"
);

Well, I did that 

 

$rules_column1 = array("
"No prop pushing, or prop killing",
"No building in the Skybox",
"No prop spamming",
"No thruster or turret noises");
 
$rules_column2 = array("
    "Do not blow up other players props on purpose",
    "Respect all players, not only admins",
    "No asking for ranks, we will give ranks when we feel like it");
 
$rules_column3 = array("
    "Do not kill people who are building on purpose",
    "Do not kill in God or in Noclip",
    "Do not Spawnkill, it is annoying and people will have temper issues",
    "Have a flawless experience");
 
?>
 
But now I get an diffrent syntax error  "syntax error unexpected 'No' (T_STRING)expecting')' "      on ---> "No prop pushing, or prop killing",

 

  • Solution

I didnt get this error, I tried this on my page and it works without errors

$rules_column1 = array(
"No prop pushing, or prop killing",
"No building in the Skybox",
"No prop spamming",
"No thruster or turret noises"
);

foreach($rules_column1 as $rule){
	echo $rule . "<br>";
}

/*
The Result was
No prop pushing, or prop killing
No building in the Skybox
No prop spamming
No thruster or turret noises
*/

It should have told you which line of code is generating error, note if it is the same line where "No Pro..." exists or is it where you are getting values with a loop?

Edited by Digitizer
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.