<?php
/*
Function: eexplode
Explodes an string and removes any empty
elements in the resulting array
Parameters:
$separator - The separator used to explode the $string
$string - The string to explode
Returns:
An array with no empty elements
Example:
print_r(explode(":","evan:walsh:"));
Array(
[0] => evan
[1] => walsh
[2] =>
);
print_r(eexplode(":","evan:walsh:"));
Array(
[0] => evan
[1] => walsh
);
*/
function eexplode($separator,$string){
$array = explode($separator,$string);
foreach($array as $key => $val){
if(empty($val)){
unset($array[$key]);
}
}
return $array;
}