使用codeigniter创建数组输出(json)

How to print an array like in the sample below with Codeigniter

my code:

public function getDatas()
{

        $this->db->from('table');

        $query = $this->db->get();

        $data =  $query->result();

        $return = array();

        foreach($data as $datas)
        {

            $return[] = $datas->value1;
            $return[] = $datas->value1;
        }

         return json_encode($return);
}

I'd like to get this sample, but my code fails somehow?

[[1,3,'test','data'],[4,56,'test','data'],[44,98,'test','data']];

your foreach should look like this :

foreach($data as $datas)
        {

            $return[] = array(1,3,'test',$yourdata);
        }