Php ordered linear table
SeqArr = $ arr; $ this-> length = count ($ arr);}/** returns the $ index data element in the linear table */public function GetElem ($ index) {if ($ this-> length) = 0 | $ index <0 | ($ index> $ this-> length) {return "Error ";} return $ this-> seqArr [$ index-1];}/** returns the length of the linear table **/public function ListLength () {return $ this-> length ;} /** return the location of the given data element in the linear table */public function LocateElem ($ elem) {for ($ I = 0; $ I <($ this-> length ); $ I ++) {if ($ this-> seqArr [$ I]) ==$ elem) {return $ I + 1 ;}}/ ** PriorElem: returns the first element of the specified element */public function PriorElem ($ elem) {for ($ I = 0; $ I <($ this-> length); $ I ++) {if ($ this-> seqArr [$ I]) ==$ elem) {if ($ I = 0) {return "Error (is null )";} else {return $ this-> seqArr [$ I-1] ;}}}/** NextElem: returns the last element of the specified element */public function NextElem ($ elem) {for ($ I = 0; $ I <($ this-> length ); $ I ++) {if ($ this-> seqArr [$ I]) = $ elem) {return $ this-> seqArr [$ I + 1] ;}}/ ** ListInsert: Insert the element elem */public function ListInsert ($ index, $ elem) {if ($ this-> length) = 0 | $ index <0 | $ index> ($ this-> length )) {return "Error" ;}for ($ I = $ index; $ I <($ this-> length); $ I ++) {$ this-> seqArr [$ I + 1] = $ this-> seqArr [$ I] ;}$ this-> seqArr [$ index] = $ elem; $ this-> length = $ this-> l Ength + 1; return $ this-> seqArr;}/** ListDelete: delete the element at the index */public function ListDelete ($ index) {if ($ this-> length) = 0 | $ index <0 | $ index> ($ this-> length-1 )) {return "Error";} unset ($ this-> seqArr [$ index]); array_values ($ this-> seqArr); return $ this-> seqArr ;}}?>