Hi there,
I think this might be difficult, or, dare I say, impossible?
If, for example, the stuff below were my arrays, is there a way to find which ones have a matching [0] value and find the total count and also return it's value?
For example:
Let's say my sql table has two fields, name and groceries, where groceries are imploded upon entry and exploded upon retrieval.
Ultimately, the values of $example (in various cases) looks like this:
$example = array("fruits", "vegetables", "meat");
$example = array("vegetables", "milk", "cheese", "bread", "eggs");
$example = array("fruits", "milk", "nuts");
$example = array("fruits", "cheese", "bread");
$example = array("vegatables", "milk", "cheese", "bread");
What I want to do is:
(1) Find which arrays have a matching [0] element. In this case, cases 1, 3, and 4 match, and cases 2 and 5 match.
(2) Then, I want to print something like this:
Fruits 3
Vegetables 2
I should also mention that I don't know the string values that begin the records. For all I know, it could be eggs or bread that starts it off. So, I don't want to do something that would require having to search for a string within the array.
Is this even possible? Can someone help me out here?
Thanks!