Add more strings in an object with php

Posted by Nakome on Stack Overflow See other posts from Stack Overflow or by Nakome
Published on 2012-12-07T22:59:10Z Indexed on 2012/12/07 23:03 UTC
Read the original article Hit count: 248

Filed under:
|

how can I add more strings in this object with php. I have managed to generate strings, but do not add more strings in an objects, nor remove the last comma.

like this:

Before,



    {
        "themes":[
        {
            "name": "Amelia",
            "description": "Sweet and cheery.",
            "thumbnail": "http://bootswatch.com/amelia/thumbnail.png"
            }
        ]
    }

After,



    {
        "themes":[
                {
            "name": "juan",
            "description": "esto es un ejemplo.",
            "thumbnail": "http://example.com"
            },
                    {
            "name": "juan2",
            "description": "esto es un ejemplo2.",
            "thumbnail": "http://example2.com"
            },
        ]
    }

Thanks and sorry for my english.

© Stack Overflow or respective owner

Related posts about php

Related posts about JSON