I want to remove empty value in array and remove value that contain only one word.
This is my code:
$all = "smart lion, smart duck, small ant, , pig";
$allkey = explode (',',$all);
$allkey = array_unique($allkey);
for ($i = 0; $i < (count($allkey)); $i++)
{
if (str_word_count($allkey[$i]) < 2)
{
unset($allkey[$i]);
}
else
{
echo $allkey[$i]."<br />";
}
}
I want to remove empty value and word “pig”,
help me to make this code work.
Thank you.
There is the code
http://codepad.org/j6B2eEEX