Count(); $this->Items[$new_index] = $item; } function Item($index) { $result = ""; $result = $this->Items[$index]; return $result; } function Del($index) { $Count = $this->Count() - 1; for ($i = $index; $i < $Count; $i++) { $this->Items[$i] = $this->Items[$i + 1]; } unset($this->Items[$this->Count() - 1]); } function ExplodeStr($dec, $str) { $items_array = explode($dec, $str); $Count = count($items_array); for ($i = 0; $i < $Count; $i++) { $this->Add($items_array[$i]); } } function ToStr($dec = "") { $result = ""; for ($i = 0; $i < $this->ItemsCount(); $i++) { $item = $this->Item($i); if ($result != "") { $result = $result.$dec; } $result = $result.$item; } return $result; } function ItemIndex($item) { //$result = -1; $Count = $this->ItemsCount(); for ($i = 0; $i < $Count; $i++) { if ($this->Item($i) == $item) { return $i; //$result = $i; } } //return $result; return -1; } } ?>Items[$_item_index] = $_item; } // проверяет наличие элемента по $_index public function IsExist($_index) { return isset($this->Items[$_index]); } // получения элемента по $_index function Item($_index) { $result = ""; if ($this->IsExist($_index)) { $result = $this->Items[$_index]; } return $result; } // удаление элемента по $_index function Del($_index) { unset($this->Items[$_index]); } // получение индекса элемента function ItemIndex($item) { foreach ($this->Items as $key => $value) { if ($this->Item($key) == $item) { return $key; //$result = $key; } } return ""; //return $result; } // получение значений ключей public function GetKeys() { return array_keys($this->Items); } public function WriteToString() { $Result = ""; foreach ($this->Items as $key => $value) { if ($Result !== "") { $Result .= "[ITEM_END]"; } $Result .= $key."[VALUE]".$value; } return $Result; } public function ReadFromString($_string) { $Params = explode("[ITEM_END]", $_string); for ($i = 0; $i < count($Params); $i++) { $ParamStr = $Params[$i]; $Param = explode("[VALUE]", $ParamStr); $this->Add($Param[1], $Param[0]); } } } ?>Name); } function ItemByName($name) { $result = false; foreach ($this->Items as $key => $value) { if ($key === $name) { return $value; } /* if ($this->Item($key)->Name == $name) { $result = $this->Item($key); } */ } return $result; } } ?>