PHP mental retardation I have such an Array ([A] & gt; 22 [B] & gt; 12 [C] & gt; 6) & nbsp; how can I get the value of the corresponding attribute, and then output A: 22, B: 12, C: 16 format ?? One problem is that this ABC is not fixed. it may be EFG (dynamic) ------ solution ------------------ I think you want PHP to be mentally retarded
I have such an Array ([A] => 22 [B] => 12 [C] => 6)
How can I get the value of the corresponding attribute, and then output A: 22, B: 12, C: 16 format ??
One problem is that A \ B \ C is not fixed. it may be E \ F \ G (dynamic)
------ Solution --------------------
I think you want this.
$ Ar = array ('a' => 22, 'B' => 12, 'C' => 6 );
Echo json_encode ($ ar );
{"A": 22, "B": 12, "C": 6}
------ Solution --------------------
I think the same is true for the landlord .. Json format
Discussion
I think you want this.
$ Ar = array ('a' => 22, 'B' => 12, 'C' => 6 );
Echo json_encode ($ ar );
{"A": 22, "B": 12, "C": 6}