如何将数组中的空值移动到其末尾位置?
例如:
$givenArray = array(
0=>'green',
1=>'',
2=>'red',
3=>'',
4=>'blue'
);
$requiredArray = array(
0=>'green',
1=>'red',
2=>'blue',
3=>'',
4=>''
);
只要非空值不被排序。也就是说,只有空值会移动到数组的末尾。 我需要的正是我示例中展示的内容。