md arrays
| From: | Justin French | Date: | Wed, 22 Sep 2004 06:35:18 +0000 |
| Subject: | md arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-197521@lists.php.net to get a copy of this message | ||
I have an array that looks something like this:
$cart => Array
(
[0] => Array
(
[id] => LT4697
[qty] => 1
)
[1] => Array
(
[id] => LT4153
[qty] => 3
)
[2] => Array
(
[id] => LT4697
[qty] => 1
)
)
I'm aware that I probably could just have a single dimension array, but there's more to be added later, and I prefer to treat this data like rows from mysql.
Anyway, what's the *least expensive* way to:
- check if an item (eg LT4153) is in the cart already?
- get the current qty of an item (eg LT4153)
The cart won't be big, so a foreach() on the cart isn't out of question, but I'd like to know the *right* way :)
TIA
Justin