Multidimensional Array Search
Posted: Mon Jul 12, 2010 5:41 pm
Here is my array:
$albums = array(
array ( array('20100625','20100625001','6/25/2010','Shelley Jones Appel, Jamison Sweet, Christine Lehmann, Heather Graham Thomspon, and Amelia Bailey Counts'),
array('20100625','20100625002','6/25/2010','Shelley Jones Appel, Amelia Bailey Counts, Maurice Holmes, Heather Graham Thompson, Cheryl Rajnoha Buneta, and Shannon Simpson'),
array('20100625','20100625003','6/25/2010','Shannon Simpson, Rebecca Harp Pitet, Cheri Storf Brown, and Patricia Hudson Schneller'),
array('20100625','20100625004','6/25/2010','Doug Shipman, Anjula Chan, and Art Schneiderheinze'),
array('20100626a','20100626p001','6/26/2010','Tim Schanuth, Kathy Waeltermann Schanuth, Stephanie Mills Moore'),
array('20100626a','20100626p002','6/26/2010','Shawn Morrison McAteer, Stephanie Mills Moore, and Kathy Chard Schormann'),
array('20100626a','20100626p003','6/26/2010','Kathy Waeltermann Schanuth and Valerie McClure Smith'),
array('20100626a','20100626p004','6/26/2010','Kathy Chard Schormann and Christine Schaefer Monteith'),
array('20100626a','20100626p005','6/26/2010','Jennifer Bosenbecker Bruner, Jon Bruner, Sam, and Kate'),
array('20100626a','20100626p006','6/26/2010','Jennifer Bosenbecker Bruner, Jon Bruner, Kathy Chard Schormann, and Christine Schaefer Monteith'),
array('20100626b','20100626g043','6/26/2010','Lisa Steinkoetter Hezel, Art Schneiderheinze, and Kimberly Monken'),
array('20100626b','20100626g044','6/26/2010','Laura Appleton, Mary Tanurchis Groedeon, Michelle Tanurchis, Kelly Nolan Kunz, Erin Wolkowitz Swinson, and Alexander Nottmeier'),
AND SO FORTH
I want to find where at what point the first element changes from 20100625 to 20100626a (the output should be 4), and then to 20100626b, etc.
I need to know how to set a variable so it begins to display the contents of the array only after the user selects 20100625, 20100626a, 20100626b, etc. So, for the first example, the variable $variable would be set to 4.
I looked at array_search but I did not know enough to make it work.
THANKS!
$albums = array(
array ( array('20100625','20100625001','6/25/2010','Shelley Jones Appel, Jamison Sweet, Christine Lehmann, Heather Graham Thomspon, and Amelia Bailey Counts'),
array('20100625','20100625002','6/25/2010','Shelley Jones Appel, Amelia Bailey Counts, Maurice Holmes, Heather Graham Thompson, Cheryl Rajnoha Buneta, and Shannon Simpson'),
array('20100625','20100625003','6/25/2010','Shannon Simpson, Rebecca Harp Pitet, Cheri Storf Brown, and Patricia Hudson Schneller'),
array('20100625','20100625004','6/25/2010','Doug Shipman, Anjula Chan, and Art Schneiderheinze'),
array('20100626a','20100626p001','6/26/2010','Tim Schanuth, Kathy Waeltermann Schanuth, Stephanie Mills Moore'),
array('20100626a','20100626p002','6/26/2010','Shawn Morrison McAteer, Stephanie Mills Moore, and Kathy Chard Schormann'),
array('20100626a','20100626p003','6/26/2010','Kathy Waeltermann Schanuth and Valerie McClure Smith'),
array('20100626a','20100626p004','6/26/2010','Kathy Chard Schormann and Christine Schaefer Monteith'),
array('20100626a','20100626p005','6/26/2010','Jennifer Bosenbecker Bruner, Jon Bruner, Sam, and Kate'),
array('20100626a','20100626p006','6/26/2010','Jennifer Bosenbecker Bruner, Jon Bruner, Kathy Chard Schormann, and Christine Schaefer Monteith'),
array('20100626b','20100626g043','6/26/2010','Lisa Steinkoetter Hezel, Art Schneiderheinze, and Kimberly Monken'),
array('20100626b','20100626g044','6/26/2010','Laura Appleton, Mary Tanurchis Groedeon, Michelle Tanurchis, Kelly Nolan Kunz, Erin Wolkowitz Swinson, and Alexander Nottmeier'),
AND SO FORTH
I want to find where at what point the first element changes from 20100625 to 20100626a (the output should be 4), and then to 20100626b, etc.
I need to know how to set a variable so it begins to display the contents of the array only after the user selects 20100625, 20100626a, 20100626b, etc. So, for the first example, the variable $variable would be set to 4.
I looked at array_search but I did not know enough to make it work.
THANKS!