php - Trouble making a correct array structure for API response

one text

I have 2 records, I want to show a single record as they have same email ID and different orderId and payments date.I am stuck with this and could not move forward. Please help me, I really need it. I do not want to repeat userinfo two times as email and name are repeating, I just want order to come under one array.

public function getDashboardData() {
    $return = array();
    $return['userInfo'] = array();
    $temp = array();
    if ( isset($this->data['userInput']) && strlen($this->data['userInput']) > 3 ) {
        $userInput = $this->data['userInput'];
        $bindArr    = ['userInput' => "%".$userInput."%" ];
        $query      = "SELECT ju.id,ju.name,ju.email,ep.date,ep.newDateFormat,ep.packID, FROM joomla_users ju LEFT JOIN examPayments ep ON ep.email = ju.email WHERE ep.phone LIKE :userInput AND ep.isActive=1 GROUP BY ep.id  ";
        $sql = $this->PDO->runQuery($query,$bindArr);
        if($this->PDO->prepRowCount($sql) > 0) {
            while( $row = $this->PDO->prepFetch($sql) ){
                    $temp['name ']  =   $row['name'];
                    $temp['email']  =   $row['email'];
                    $temp['order'][]    =   array(
                                        'date' => array(
                                                    'startDate' => date('jS, F Y',strtotime( $row['date']))
                                        ),
                                        'order' => array(
                                                    'orderID' => $row['orderID']
                                        )
                                        
                                    );
                    $status = TRUE; 
                    array_push($return['userInfo'], $temp);             
            }
            $return['status'] = TRUE;
            return $return;
        }else {
            $return['status'] = FALSE;
            $return['message'] = "No Records Found";
        }
    }else{
        $return['status'] = FALSE;
        $return['message'] = "Data Type Error";
    }
    return $return;
}
My Output
{
"userInfo": [
    {
        "name\t": "Kunal ",
        "email": "Kunal@gmail.com",
        "order": [
            {
                "date": {
                    "startDate": "7th, August 2019",
                    "paymentDate": "7th, August 2019",
                    "expiryDate": "7th, August 2019"
                },
                "order": {
                    "orderID": "fsdfdsfdsfdsfsdfsdfsf"
                }
            }
        ]
    },
    {
        "name\t": "Kunal ",
        "email": "Kunal@gmail.com",
        "order": [
            {
                "date": {
                    "startDate": "7th, August 2019",
                    "paymentDate": "7th, August 2019",
                    "expiryDate": "7th, August 2019"
                },
                "order": {
                    "orderID": "dfdsfsfdsfsdfdsfsdfdfs"
                }
            }
        ]
    }
]

}

Source