What should I do if I use array to generate an associated array which is a string in parentheses? Yes. the values read from the database are: & quot; Peter & quot; & gt; 32, & quot; Quagmire & quot; & gt; 30, & quot; joe & quot; & gt; 34 use array (& quot; Peter & quot; & gt; 32, & quot; Quagmire & quot; & gt; 30. what should I do if I use array to generate an associated array which is a string in parentheses?
The value read from the database is:
"Peter" => 32, "Quagmire" => 30, "Joe" => 34
Use array ("Peter" => 32, "Quagmire" => 30, "Joe" => 34) to change it to an associated array, but the values are strings, is there a way to remove string attributes? Or is there any other way to save it?
Thank you very much!
------ Solution --------------------
PHP code
32, "Quagmire" => 30, "Joe" => 34'; eval ('$ arr = array ('. $ str. '); print_r ($ arr );