in_array
| From: | Karl DeSaulniers | Date: | Thu, 06 Apr 2017 08:30:41 +0000 |
| Subject: | in_array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-326058@lists.php.net to get a copy of this message | ||
Hello All,
Hope you are all experiencing some progress with yours.
Looking forward to some on mine. Have a quick question.
When traversing an multidimensional array what is the proper way to detect if a value is in one of
the indexes of the array?
EG:
Array1 = array(
0 => array("pUser" => "Customer", "pType" =>
"Offset", "pProduct" => "Business Cards"),
1 => array("pUser" => "Retailer", "pType" =>
"Offset", "pProduct" => "Flyers"),
2 => array("pUser" => "InHouse", "pType" =>
"Offset", "pProduct" => "Business Cards")
);
So I have this array and I want to add let's say a customer -> offset -> business cards,
but let's also say that there is only 1 customer is allowed to offset print at a time.
How would I check for pUser, pType to see if one exists already?
I was looking at in_array(), but my brain twisted when the multidimensional came into play.
Not sure how to apply. Any help would be greatly appreciated.
TIA.
Best,
Karl DeSaulniers
Design Drumm
http://designdrumm.com <http://designdrumm.com/>