About the multi-dimensional array,
[["name"=>"zs","age"=>"10","sex"=>"nan"],["name"=>"ls","age"=>"11","sex"=>"nan"],["name"=>"ww","age"=>"12","sex"=>"nv"]], [["name"=>"zs","age"=>"10","sex"=>"nan"],["name"=>"ls","age"=>"11","sex"=>"nan"],["name"=>"ww","age"=>"12","sex"=>"nv"]], [["name"=>"zs","age"=>"10","sex"=>"nan"],["name"=>"ls","age"=>"11","sex"=>"nan"],["name"=>"ww","age"=>"12","sex"=>"nv"]]];echo '';print_r( $class );echo '
';?>
This is always wrong. solve it.
Parse error: syntax error, unexpected '[' in D: \ program files \ wamp \ www \ text. php on line 3
Reply to discussion (solution)
What is your definition? Array? You should define it in this way.
$ Class = array ("group1" => (
("Name" => "zs", "age" => "10", "sex" => "nan "),
("Name" => "ls", "age" => "11", "sex" => "nan "),
("Name" => "ww", "age" => "12", "sex" => "nv ")
),
(
("Name" => "zs", "age" => "10", "sex" => "nan "),
("Name" => "ls", "age" => "11", "sex" => "nan "),
("Name" => "ww", "age" => "12", "sex" => "nv ")
),
(
("Name" => "zs", "age" => "10", "sex" => "nan "),
("Name" => "ls", "age" => "11", "sex" => "nan "),
("Name" => "ww", "age" => "12", "sex" => "nv ")
)
));
What is your definition? Array? You should define it in this way.
$ Class = array ("group1" => (
("Name" => "zs", "age" => "10", "sex" => "nan "),
("Name" => "ls", "age" => "11", "sex" => "nan "),
("Name" => "ww", "age" => "12", "sex" => "nv ")
),
(
("Name" => "zs", "age" => "10", "sex" => "nan "),
("Name" => "ls", "age" => "11", "sex" => "nan "),
("Name" => "ww", "age" => "12", "sex" => "nv ")
),
(
("Name" => "zs", "age" => "10", "sex" => "nan "),
("Name" => "ls", "age" => "11", "sex" => "nan "),
("Name" => "ww", "age" => "12", "sex" => "nv ")
)
));
Well, isn't it necessary to use [] as much as possible? The array in the book is not written either.
Your code requires php> = 5.4
What is your definition? Array? You should define it in this way.
$ Class = array ("group1" => (
("Name" => "zs", "age" => "10", "sex" => "nan "),
("Name" => "ls", "age" => "11", "sex" => "nan "),
("Name" => "ww", "age" => "12", "sex" => "nv ")
),
(
("Name" => "zs", "age" => "10", "sex" => "nan "),
("Name" => "ls", "age" => "11", "sex" => "nan "),
("Name" => "ww", "age" => "12", "sex" => "nv ")
),
(
("Name" => "zs", "age" => "10", "sex" => "nan "),
("Name" => "ls", "age" => "11", "sex" => "nan "),
("Name" => "ww", "age" => "12", "sex" => "nv ")
)
));
Well, isn't it necessary to use [] as much as possible? The array in the book is not written either.
Yes, but the same applies [].
$ Class ['group1'] [] = array ("name" => "zs", "age" => "10", "sex" => "nan ");
$ Class ['group1'] [] = array ("name" => "ls", "age" => "11", "sex" => "nan ");
$ Class ['group1'] [] = array ("name" => "ww", "age" => "12", "sex" => "nv ");
.
.
.
Your code requires php> = 5.4
Thank you, moderator.