I have this code:
$id = 1;
$isTemplate = true;
$address = "address, \n tel. 1234455";
I need save it in this form:
{"results": [{
"id": 1,
"isTemplate": true,
"text": "<span class=\"d-block option-head\">\n nazwa\n</span>\n<span class=\"d-none\"> - </span>\n<span class=\"d-block option-sub\">\n address,\n tel. 123456\n </span>"
]}
How can I make it?
I try:
$resultArray = array('results' => ['id'=> 1, 'isTemplate' => true, 'text'=> '<span class="d-block option-head">\n nazwa\n</span>\n<span class="d-none"> - </span>\n<span class="d-block option-sub">\n address,\n tel. 1234455\n </span>']);
but my result is wrong:
Array
(
[results] => Array
(
[id] => 1
[isTemplate] => 1
[text] => <span class="d-block option-head">\n nazwa\n</span>\n<span class="d-none"> - </span>\n<span class="d-block option-sub">\n address,\n tel. 123455\n </span>
)
)
Please help me
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2YgMiNl
via IFTTT
Aucun commentaire:
Enregistrer un commentaire