Question: Here is [my code](https://3v4l.org/VQ6Vk):

```
<?php

$arr1 = ['o' => 'vote', 'u' => 'true'];
$arr2 = ['p' => '', 'v' => 'digit'];

print_r(array_merge($arr1, $arr2));

/* Array
   (
       [o] => vote
       [u] => true
       [p] => 
       [v] => digit
   )

```

Always there is one item which has empty value. In example above, that item is `p`. Now I need to put that item as the last one. How can I do that? 

**Note:** I don't care about the order of other items. 

---

So this is expected result:

```
/* Array
   (
       [o] => vote
       [u] => true
       [v] => digit
       [p] => 
   )

```

Answer: 
One simple way I found was to use [rsort](https://secure.php.net/manual/en/function.rsort.php), which *Sort an array in reverse order*. Like so ([run](https://3v4l.org/DiN8i)):

```
$merged = array_merge($arr1, $arr2);
rsort($merged);

```

The output:

```
Array
(
    [0] => vote
    [1] => true
    [2] => digit
    [3] => 
)

```

You could also go with a simple foreach ([example](https://3v4l.org/fqghN)) or even [usort](http://php.net/manual/en/function.usort.php) ([example](https://3v4l.org/tnruP))
```
function sort($array){
        $emptyKey ="";
        foreach ($array as $key => $value){
             if(empty($value){
                  $emptyKey = $key;
                   break;
             }
        }
        unset($array[$emptyKey]);
        $array[$emptyKey] = "";
        return $array;
}

```