i am trying to put line breaks in a jSon txt file with line breaks but it doesnt seem to be responding. any suggestions please, thank you
Code:$i = 0; $entryText = '{"comments":['; foreach($entryList['comments'] as $commentItem) { $num = $newStack[$i]; $entryText .="\n" .'{"index":'.$nTotal.',"text":"'.$arrTxt[$num].'","img":"'.$arrImg[$num].'"}'; $i++; $nTotal--; if ($i < count($newStack)) {$entryText .= ','; } } $entryText .= ']}'; file_put_contents('data/cache.txt', $entryText);



Reply With Quote
Bookmarks