Why can't this string be generated?

 array(1) {
  [0]=>
  array(4) {
    ["id"]=>
    string(2) "30"
    [0]=>
    string(2) "30"
    ["date"]=>
    string(10) "2018-10-14"
    [1]=>
    string(10) "2018-10-14"
  }
} 

to generate a string in the form above, in the debug window of chrome, type

excuse me, what"s the problem?

Dec.10,2021

multiple-line string, it is impossible to recognize it when written in this way.

  • 1-es6 template string:
` array(1) {
  [0]=>
  array(4) {
    ["id"]=>
    string(2) "30"
    [0]=>
    string(2) "30"
    ["date"]=>
    string(10) "2018-10-14"
    [1]=>
    string(10) "2018-10-14"
  }
}`
  • method 2-\ (also note to avoid double quotes):
' array(1) {\
  [0]=>\
  array(4) {\
    ["id"]=>\
    string(2) "30"\
    [0]=>\
    string(2) "30"\
    ["date"]=>\
    string(10) "2018-10-14"\
    [1]=>\
    string(10) "2018-10-14"\
  }\
}'
  • effect

clipboard.png


[{"id":"30","0":"30","date":"2018-10-14","1":"2018-10-14"}]

is that what you're going to say? The format data above you can be generated by throwing it directly to the chrome console

Menu