$name 1 = "AAAAA"; $name 2 = ' bbbbb '; $data = Array ( "userid" = = $name 1, "department" = [1, 2], "position" = = $name 2, "mobile" = "15913215421", );
Want to know what the UserID and position correspond to in the $data array (is "aaaaa" or ' aaaaa ' is "bbbbb" or ' bbbbb ')
What if output $data[' userid ' and $data[' position '] are output separately ("AAAAA" or "AAAAA" is "bbbbb" or ' bbbbb ')
Reply to discussion (solution)
You Var_export ($data);
and Echo $data [' userid '];
You can see
$name 1 = "AAAAA";
$name 2 = ' bbbbb ';
Quotation marks are just delimiters and do not belong to string contents
The difference between a double-cited or a single-citation is that the double-citation interprets the variable inside, and the single-lead does not.
And your example, using single quotes and double quotes is the same.
$data [' userid '] is a string aaaaa
$data [' position '] is a string bbbbb
You Var_export ($data);
and Echo $data [' userid '];
You can see
Why I ran into this problem:
Array (' userid ' = ' \ ' ABC123 ' \ ',..............)
One of the strings passed in and forced the quotes into the box, so we brought two escape characters, "\"
$name 1 = "AAAAA";
$name 2 = ' bbbbb ';
Quotation marks are just delimiters and do not belong to string contents
The difference between a double-cited or a single-citation is that the double-citation interprets the variable inside, and the single-lead does not.
And your example, using single quotes and double quotes is the same.
$data [' userid '] is a string aaaaa
$data [' position '] is a string bbbbb
You Var_export ($data);
and Echo $data [' userid '];
You can see
Why I ran into this problem: When printing the entire array
Array (' userid ' = ' \ ' ABC123 ' \ ',..............)
One of the strings passed in and forced the quotes into the box, so we brought two escape characters, "\"
You Var_export ($data);
and Echo $data [' userid '];
You can see
You Var_export ($data);
and Echo $data [' userid '];
You can see
Why I ran into this problem: when I printed the entire array (the one that was wrong just now)
Array (' userid ' = ' \ ' abc123\ ',..............)
One of the strings passed in and forced the quotes into the box, so we brought two escape characters, "\"