$myArray = array (\'SOmeKeyNAme\' => 7);
I want $myArray[\'somekeyname\'] to return 7.
Is there a way to do this
You can lowercase your keys when assigning them to the array and also lowercase them when looking up the value.
Without modifying the array, but the whole data structure:
A really cumbersome way involves creating magic getter/setter methods, but would it really be worth the effort (note that the other methods have to be implemented too)?
m_values = array();
}
public function __get($key)
{
return array_key_exists($key, $this->m_values) ? $this->m_values[$key] : null;
}
public function __set($key, $value)
{
$this->m_attributes[$key] = $value;
}
}