public function _is_assoc(&$array)
{
/*
* Empty array should default to associative
* SRS was having issues with empty attribute arrays
*/
if (empty($array)) {
return true;
}
if (is_array($array)) {
foreach ($array as $k => $v) {
if (!is_int($k)) {
return true;
}
}
}
return false;
}
/** * Should return true for associative, and false for plain. */ public function testIsAssoc() { $ops = new Ops(); $no = array(1, 2, 3, 4); $yes = array('this' => 'is', 'associative'); $this->assertFalse($ops->_is_assoc($no)); $this->assertTrue($ops->_is_assoc($yes)); }