I'm trying to grab all the unique values of an array.
$Arr_TitleID = "92 1 92 38 1 6 1";
echo "Arr_TitleID: " . $Arr_TitleID;
$TitleID_Explode = explode(" ", $Arr_TitleID);
$BigTitleID_Explode = array_unique($TitleID_Explode);
$CTID_count = count($BigTitleID_Explode);
echo "count(CTID_count): " . $CTID_count;
for($i = 0; $i < $CTID_count; $i++)
{
echo "Piece $i = $BigTitleID_Explode[$i]";
}
Output:
Arr_TitleID: 92 1 92 38 1 6 1 count(CTID_count): 4 Piece 0 = 92 Piece 1 = 1 Piece 2 = Piece 3 = 38
Where is number 6? And why is there a blank where the number 6 should be?
array index is not sequential like 0, 1, 2, 3
array index is 0, 1, 3, 5
So edit code like this, just add one line to re-indexing as numeric value
//just add bellow line
//