Forgive my simplistic code below, I am just learning arrays.....
My aim is to explode a comma-delimited result into its separate parts. Then, assign each separate part to a new variable. And, I want to know the total number of variables assigned at the end.
======== SAMPLE CODE ================
$theCat = "text1,text2,text3,text4";
$pieces = explode(",", $theCat);
foreach($pieces as $key=>$value){
// assigns the value to a new variable based on the key
$var[$key] = $value;
}
=========== END SAMPLE =============
The result, considering the contents of "$theCat" above would be that 4 variables would be created.
$var0 = text1;
$var1 = text2;
$var2 = text3;
$var3 = text4;
That is fine and dandy. What I need to know is, how can I determine (Count) the number of variables that are created (assuming that $theCat will hold a different number of comma-delimited results each time)?
$Total_Count = ???
Thanks for any assistance you can provide.