Domanda

How can I get an array such as this:

$array = array(
    "test1" => "blah1",
    "test2" => "blah2",
);

converted to a string like this:

$string = {"test1":"blah1","test2":"blah"}

The array may vary in size so it will have to be dynamic.

Thanks ahead of time.

È stato utile?

Soluzione

This is JSON. Use json_encode().

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top