require('obj.marray.php'); $array=new marray(); // required for objectIf you would rather use the compressed version, or functions, include that file instead.
table,tr,td
$array=new marray();
$array=new marray(); $array->set("table,tr,td", 1); echo $array; /* Returns: Array ( [table] => Array ( [tr] => Array ( [td] => 1 ) ) ) */
$array=new marray(); $array->set($array, "table,tr,td", 1); $loc_array=$array->get("table,tr"); print_r($loc_array); /* Returns: Array ( [td] => 1 ) */
$array=new marray(); echo $array->loc("table,tr,td"); // Returns: ['table']['tr']['td']
$array=new marray(); $array->set("table,tr,td", array('a'=>1,'b'=>2)); echo $array->count("table,tr,td"); // Returns: 2
$array=new marray(); $array->set("table,tr,td", 1); if($array->is_empty("table,tr,td")) { echo "td empty"; } if($array->is_empty("table,trrr")) { echo "trrr empty"; } // Prints: trrr empty
$array=new marray(); $array->set("table,tr,td", 1); if($array->is_set("table,tr,td")) { echo "is_set"; } if($array->is_set("table,trrr")) { echo "another is_set"; } // Prints: is_set // Doesn't print: another is_set
echo marray_loc("table,tr,td"); // Returns: ['table']['tr']['td']
marray_set($array, "table,tr,td", 1); print_r($array); /* Returns: Array ( [table] => Array ( [tr] => Array ( [td] => 1 ) ) ) */
marray_set($array, "table,tr,td", 1); $loc_array=marray_get($array, "table,tr"); print_r($loc_array); /* Returns: Array ( [td] => 1 ) */
marray_set($array, "table,tr,td", array('a'=>1,'b'=>2)); echo marray_count($array, "table,tr,td"); // Returns: 2
marray_set($array, "table,tr,td", 1); if(marray_is_empty($array, "table,tr,td")) { echo "td empty"; } if(marray_is_empty($array, "table,trrr")) { echo "trrr empty"; } // Prints: trrr empty
marray_set($array, "table,tr,td", 1); if(marray_is_set($array, "table,tr,td")) { echo "is_set"; } if(marray_is_set($array, "table,trrr")) { echo "another is_set"; } // Prints: is_set // Doesn't print: another is_set