0

sorry my english is bad. I use google translation. i have 2 veriable. I did not get the output I wanted. the output format I want is as follows

$texts= "{1,3} Test asd
{2} Test qwe
{2,3} Test 123
{3} Test zxc
{3,4} Test vbn";

$urls= "{1} http://example.com/asd
{2} http://example/qwe
{3} http://example/123
{4} http://example/zxc"

Want Output

{
    "1":[{"url":"http://example.com/asd"},
        {"text":["Test asd"]}
    ],
    "2":[{"url":"http://example.com/qwe"},
        {"text":["Test qwe","Test 123"]}
    ],
    "3":[{"url":"http://example.com/123"},
        {"text":["Test 123","Test zxc","Test vbn"]}
    ],
    "4":[{"url":"http://example.com/zxc"},
        {"text":["Test vbn"]}
    ]

}
  • 1
    [See previous answer](https://stackoverflow.com/questions/6054033/pretty-printing-json-with-php) – Mark S. Feb 02 '18 at 23:27
  • @MarkS. Did you link to the answer you meant to? It seems like there's more of a problem here than just pretty printing. – Don't Panic Feb 02 '18 at 23:34
  • @Ahmet, where do `$texts` and `$urls` come from? Are you using some code that tries to parse those and create an array to json_encode? Can you include the relevant code? – Don't Panic Feb 02 '18 at 23:38

0 Answers0