function QPACssEventHandler::setVal in QueryPath 7.3
Same name and namespace in other branches
- 6 qpa/qpa.classes.inc \QPACssEventHandler::setVal()
- 7.2 qpa/qpa.classes.inc \QPACssEventHandler::setVal()
Set the value of an item in a deeply nested array.
File
- qpa/
qpa.classes.inc, line 53 - qpa.classes
Class
- QPACssEventHandler
- qpa.classes
Code
function setVal($key, $value) {
$t =& $this->arr;
$c = count($key);
for ($i = 0; $i < $c; ++$i) {
$part = $key[$i];
if ($c - 1 == $i) {
$t[$part] = $value;
}
else {
$t =& $t[$part];
}
}
return $t;
}