I am not PHP Developer. I have one Android Application in which I am displaying share and like counts with below API

```
mysqli_query($conn,"SET NAMES utf8");
$sql = "SELECT tbl_quotes.*,au_picture as picture FROM tbl_fav INNER JOIN tbl_quotes INNER JOIN tbl_category  ON user_id='".$userId."' AND qu_author=_auid  AND fav_qu_id=_quid Order By '".$order."' DESC LIMIT ".$limit." OFFSET ".$offset;

$result = mysqli_query($conn, $sql);

$arr = array();
while($r = mysqli_fetch_assoc($result)) {

    $arr[] = $r;
}

echo json_encode($arr, JSON_UNESCAPED_UNICODE);

mysqli_close($conn);

```

Now I want convert that number in K style like below code

```
if ($value > 999 && $value <= 999999) {
    $result = floor($value / 1000) . ' K';
} elseif ($value > 999999) {
    $result = floor($value / 1000000) . ' M';
} else {
    $result = $value;
}

```

like field is qu\_like and share field is qu\_share. Anyone can please help me how can I use this function for convert numbers and include it in my json ?

Thanks