Let's simplify this a bit.
Code:
$lineItem = explode ("*", $bigData);
divides the array based on "*".
In the case of $bigData="a*b"; you have:
Code:
$lineItem[0]=="a";
$lineItem[1]=="b";
In the case of $bigData="a**b"; you have:
Code:
$lineItem[0]=="a";
$lineItem[1]=="";
$lineItem[2]=="b";
The explode function first takes "a" from "a**b" creating $lineItem[0]=="a"; and leaving "*b" because the first * was used as a divider and removed as well.
explode now takes "*b" and divides it into two values. That part to the left of "*" is nothing so the second value created is $lineItem[1]==""; and the last part to the right is "b" which is $lineItem[2]=="a";.
In the case of "a**"
you will have:
Code:
$lineItem[0]=="a";
$lineItem[1]=="";
$lineItem[2]=="";
a = the first piece.
""= the part between "a" and the first "*".
""= the part between the second "*" and the nothing to the right of the second "*".
Bookmarks