For some reason I can not determine why empty array keys aren't being unset
. Here is what I have...
PHP
<?php
$attachments = explode('|',$_POST['post_attachments']);
foreach($attachments as $k=>$v)
{
echo 'k = \''.$v."'
";
if ($v=='')
{
unset($k);
}
}
print_r($attachments);die();
?>
Output
k = ''
k = 'secret_afound.gif'
k = 'secret_aunlocked.gif'
Array (
[0] => [1] => secret_afound.gif [2] => secret_aunlocked.gif
)