No doubt it has been discussed few million times here and yes once again I am posting something related with it.
I have the following code.
$address = "#&#&#&";
$addr = explode("#&",$address);
it returns
Array
(
[0] =>
[1] =>
[2] =>
[3] =>
)
Now the values are empty.So I am doing a check.
If(!empty($addr))
{
echo 'If print then something wrong';
}
And it still prints that line.Not frustrated yet but will be soon
preg_split()with thePREG_SPLIT_NO_EMPTYflag may be of interest to you. It splits strings based on a regular expression and allows you to discard empty pieces with the mentioned option.