On a problem with multidimensional arrays,

Source: Internet
Author: User
Tags parse error
 
  [["Name" = "Zs", "age" = "ten", "Sex" and "Nan"],["name" = "ls", "age" = "one", "sex" = "nan"],["name" = > "ww", "Age" and "ten", "Sex" and "NV"], [["Name" + "Zs", "age" = "+", "sex" = "nan"],["name" = "ls", " Age "+", "Sex" and "Nan"],["name" = "ww", "age" = "a", "sex" = "NV"], [["Name" = "Zs", "Age" = " "," "Sex" and "Nan"],["name" = "ls", "Age" and "one", "sex" = "nan"],["name" = "ww", "age" = "ten", "Sex" = > "NV"]]];echo '
';p rint_r ($class); Echo '
';? >

This is always wrong, solving.
Parse error:syntax error, unexpected ' [' D:\program files\wamp\www\text.php on line 3


Reply to discussion (solution)

What is your definition of this? Array? It should be defined as your idea.

$class =array ("group1" = (
("Name" = "Zs", "age" = "ten", "sex" = "Nan"),
("Name" = "ls", "age" = "one", "sex" = "Nan"),
("Name" = "ww", "age" = "+", "sex" = "NV")
),
(
("Name" = "Zs", "age" = "ten", "sex" = "Nan"),
("Name" = "ls", "age" = "one", "sex" = "Nan"),
("Name" = "ww", "age" = "+", "sex" = "NV")
),
(
("Name" = "Zs", "age" = "ten", "sex" = "Nan"),
("Name" = "ls", "age" = "one", "sex" = "Nan"),
("Name" = "ww", "age" = "+", "sex" = "NV")
)
)) ;

What is your definition of this? Array? It should be defined as your idea.

$class =array ("group1" = (
("Name" = "Zs", "age" = "ten", "sex" = "Nan"),
("Name" = "ls", "age" = "one", "sex" = "Nan"),
("Name" = "ww", "age" = "+", "sex" = "NV")
),
(
("Name" = "Zs", "age" = "ten", "sex" = "Nan"),
("Name" = "ls", "age" = "one", "sex" = "Nan"),
("Name" = "ww", "age" = "+", "sex" = "NV")
),
(
("Name" = "Zs", "age" = "ten", "sex" = "Nan"),
("Name" = "ls", "age" = "one", "sex" = "Nan"),
("Name" = "ww", "age" = "+", "sex" = "NV")
)
)) ;


Well, the book said not to try to use [] it? I didn't write an array in the book.

Your code requires PHP >= 5.4


What is your definition of this? Array? It should be defined as your idea.

$class =array ("group1" = (
("Name" = "Zs", "age" = "ten", "sex" = "Nan"),
("Name" = "ls", "age" = "one", "sex" = "Nan"),
("Name" = "ww", "age" = "+", "sex" = "NV")
),
(
("Name" = "Zs", "age" = "ten", "sex" = "Nan"),
("Name" = "ls", "age" = "one", "sex" = "Nan"),
("Name" = "ww", "age" = "+", "sex" = "NV")
),
(
("Name" = "Zs", "age" = "ten", "sex" = "Nan"),
("Name" = "ls", "age" = "one", "sex" = "Nan"),
("Name" = "ww", "age" = "+", "sex" = "NV")
)
)) ;


Well, the book said not to try to use [] it? I didn't write an array in the book.


Yes, but the same is true with []
$class [' group1 '][]=array ("name" = "Zs", "age" = "ten", "sex" = "Nan");
$class [' group1 '][]=array ("name" = "ls", "age" = "one", "sex" = "Nan");
$class [' group1 '][]=array ("name" = "ww", "Age" = "n", "Sex" = "NV");
.
.
.

Your code requires PHP >= 5.4


Ah, long knowledge, thank you moderator
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.