How can I move the empty values of an array to its last position?
For example:
$givenArray = array(
0=>'green',
1=>'',
2=>'red',
3=>'',
4=>'blue'
);
$requiredArray = array(
0=>'green',
1=>'red',
2=>'blue',
3=>'',
4=>''
);
Provided that the non empty values should not be sorted. It should be as it is, i.e. only the empty values should move to the end of an array.
I need exactly what my examples show.