Jons format questions about how numeric types with single quotes are removed

Source: Internet
Author: User
Jons format problem how numeric type with single quotes how to remove
How to remove single quotes
$arr =array (' as ' =>1, ' data ' =>array (' ID ' = + $r _id, ' List ' + $ZFC));
Echo Json_encode ($arr, json_force_object);
{
"as": 1,
"Data": {
"ID": "111",
"Needimglist": "1.jpg,2.jpg"
}
}

How to remove the double quotation mark of "111" in ID???
------to solve the idea----------------------
$r _id = 111;
$ZFC = ' 123 ';
$arr =array (' as ' =>1, ' data ' =>array (' ID ' = + $r _id, ' List ' + $ZFC));

------to solve the idea----------------------
Json_pretty_print);
{
"as": 1,
"Data": {
"ID": 111,
"List": "123"
}
}
The double quotes of "111" are the result of your own (string)
That's no way to write.
$arr =array (' as ' =>1, ' data ' =>array (' ID ' = intval ($r _id), ' List ' = $ZFC));

------to solve the idea----------------------
Because it is a character type, there are quotation marks, so you can change it.

$arr =array (' as ' =>1, ' data ' =>array (' ID ' =>intval ($r _id), ' List ' = + $ZFC));
Echo Json_encode ($arr, json_force_object);

------to solve the idea----------------------


$arr =array (' as ' =>1, ' data ' =>array (' ID ' = + $r _id+0, ' List ' + $ZFC));
Echo Json_encode ($arr, json_force_object);

  • 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.