src/ets.php
function get_value($parent, $varname)
	{
		if (isset($parent->$varname)) {
			return $parent->$varname;
		} else {
			$elements = explode('[', $varname);
			if (count($elements) == 1) {
				return NULL;
			} else {
				$vartest = $parent;
				foreach ($elements as $elementid => $element) {
					if ($elementid == 0) {
						$vartest = $parent->$element;
						if (!isset($vartest)) {
							return NULL;
						}
					} else {
						$index = substr($element, 0, -1);
						if ($index == '_first') {
							$keys = array_keys($vartest);
							$index = $keys[0];
						} elseif ($index == '_last') {
							$keys = array_keys($vartest);
							$index = $keys[count($keys) - 2];
						}
						if (!isset($vartest[$index])) {
							return NULL;
						} else {
							$vartest = $vartest[$index];
						}
					}
				}
			}
			return $vartest;
		}
	}
function get_value($parent, $varname)
	{
		if (isset($parent->$varname)) {
			return $parent->$varname;
		} else {
			$elements = explode('[', $varname);
			if (count($elements) == 1) {
				return NULL;
			} else {
				$vartest = $parent;
				foreach ($elements as $elementid => $element) {
					if ($elementid == 0) {
						$vartest = $parent->$element;
						if (!isset($vartest)) {
							return NULL;
						}
					} else {
						$index = substr($element, 0, -1);
						if ($index == '_first') {
							$keys = array_keys($vartest);
							$index = $keys[0];
						} elseif ($index == '_last') {
							$keys = array_keys($vartest);
							$index = $keys[count($keys) - 2];
						}
						if (!isset($vartest[$index])) {
							return NULL;
						} else {
							$vartest = $vartest[$index];
						}
					}
				}
			}
			return $vartest;
		}
	}
Retrieve the value of a string representation of a variable