<?php
    if (!empty($winner)){
        $no=1;
    foreach(array_slice($winner, 0, 60) as $winner){
    $in = $winner->username;     
    $out = strlen($in) > 4 ? substr($in,0,4)."***" : $in;
    $winner = array(
        'no' => $no++,
        'username' => $out,
        'value' => $winner->winner
    );
    $data[] = $winner;
    }

    echo json_encode($data);
    }else{
    $data = array('Error'=>"Data is Empty!");
    echo json_encode($data);
    }
?>