Menu
I run into a piece of PHP code at the end of this e-mail when trying to learn about array. This code assumes the variable ‘contents’ is a 2-dimensional array once it is verified being an array. Why can’t it other dimension? Thanks!
class pacakage
{
var contents;
…..
function getData()
{
// insert current cart contents in database
if (is_array($this->contents))
{
reset($this->contents);
while (list($products_id, ) = each($this->contents))
{
$qty = $this->contents[$products_id][‘qty’];
…………………….
}
}