saintx adlı üyeden alıntı: mesajı görüntüle
@RHX;

<?php
	
	header("Content-Type: text/plain; charset=UTF-8");
	
	$results = (object) array(
		"status" => true,
		"category" => (object) array(
			"ID" => 1,
			"title" => "title",
			"description" => "description"
		),
		"posts" => array()
	);
	
	for($i = 1; $i <= 10; ++$i)
		$results->posts[] = (object) array(
			"ID" => $i,
			"type" => "post_" . $i,
			"title" => "title_" . $i,
			"content" => "content_" . $i,
			"excerpt" => "excerpt_" . $i,
			"published_at" => (time() - ($i * 60 * 60)),
			"comments" => array()
		);
	
	### DÖNGÜYE ALMAK İÇİN ###
	
	foreach($results->posts as $post)
		print_r($post);

Hocam bu şekilde yaptığımda çıktı istediğim formatta olmuyor. İstediğim şablon :

{
    "status": true,
    "category": {
        "ID": 1,
        "title": "title",
        "description": "description"
    },
    "posts": [
        {
            "ID": 1,
            "type": "post",
            "title": "title",
            "content": "content",
            "excerpt": "excerpt",
            "published_at": 1384024870,
            "comments": [

            ]
        },
        {
            "ID": 2,
            "type": "post",
            "title": "title",
            "content": "content",
            "excerpt": "excerpt",
            "published_at": 1384197670,
            "comments": [

            ]
        }
    ]
}
Bu şekilde çıktı alabilir miyiz ? ama
{
            "ID": 2,
            "type": "post",
            "title": "title",
            "content": "content",
            "excerpt": "excerpt",
            "published_at": 1384197670,
            "comments": [

            ]
        }
içinde takrar edecek şekilde ?