<?
//this example only works with strings but dlist also supports objects in the same way
require_once("./dList.php");
//Create an object of dList
$myList=new dList();
//Set the parameters for db Features
//Parameters: Server,User,DbPassword,Database,Table name, Autocreate Table
$myList->SetDbParameters("localhost:3306","root","","test","dList",true);
//Manually set the identification string to look for data of recent sessions
$myList->SetIdentity("list:2719");
//echo "<br>->".$myList->GetIdentity()."<-<br>";
//Load the data of recent sessions
$myList->Load();
$myList->SwitchToDbMode(); //Switch to direct Database mode
//$myList->SwitchToMemoryMode();
//Try some from the commented commands to see how powerful this list is
//$myList->SetCapacity(4);
//Add some additional data
$myList->Add(" 1 ");
$myList->Add(" 2 ");
$myList->Add(" 3 ");
$myList->Add(" 4 ");
$myList->Add(" 5 ");
$myList->Add(" 6 ");
$myList->Add(" 7 ");
$myList->Add(" 8 ");
$myList->Add(" 9 ");
//if($myList->Contains(" 4 "))echo "jo";
//echo $myList->Get(3);
//$myList->Insert("Juhu",4);
//$myList->Save();
//$myList->RemoveRange(0,2);
$myList->RemoveAt(4);
//$myList->Reverse();
$myList->EchoList();
echo "<br>";
//$myList->RemoveAt(3);
//$myList->Remove(" 3 ");
//$myList->EchoList();
echo "<br>";
//echo $myList->IndexOf(" 2 ");
//echo $myList->LastIndexOf(" 2 ");
echo "<br>";
//$subList=$myList->GetRange(2,3);
//$subList->EchoList();
echo "<br>";
//$myList->Reverse();
//$myList->RemoveRange(1,2);
//$myList->EchoList();
?>
|