Location: PHPKode > scripts > dList v3 > dlist/dListExample.php
//this example only works with strings but dlist also supports objects in the same way

//Create an object of dList
$myList=new dList();
//Set the parameters for db Features
//Parameters: Server,User,DbPassword,Database,Table name, Autocreate Table

//Manually set the identification string to look for data of recent sessions

//echo "<br>->".$myList->GetIdentity()."<-<br>";

//Load the data of recent sessions
$myList->SwitchToDbMode(); //Switch to direct Database mode

//Try some from the commented commands to see how powerful this list is


//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);

echo "<br>";
//$myList->Remove(" 3 ");
echo "<br>";
//echo $myList->IndexOf(" 2 ");
//echo $myList->LastIndexOf(" 2 ");
echo "<br>";
echo "<br>";

Return current item: dList v3