Location: PHPKode > scripts > Array to List > array-to-list/example.php
 <TITLE>Working with Arrays</TITLE>
               "occupation" => "Student",
               "age" => 23,
               "special power" => "Java Programming"
               ) ;
 $characters = array(
                   "name" => "Bob",
                   "occupation" => "superhero",
                   "age" => 30,
                   "special power" => "x-ray vision"
                  "name" => "Sally",
                  "occupation" => "superhero",
                  "age" => 24,
                  "special power" => "superhuman strength"
                  "name" => "Jane",
                  "occupation" => "arch villain",
                  "age" => 45,
                  "special power" => "nanotechnology"
//getting outputs and testing types
echo('<b><u>Type of variable $myChar is :</u></b><br>');
print_r($myChar);//prints human readable details of a variable $myChar

echo("<hr color='red' size=3><b><u>So My Details is:</u></b><br>");
foreach($myChar as $k=>$v)
   echo("My $k is :<b>$v</b><br>");

echo("<hr color='blue' size=3><b><u>Type of variable \$characters is :</u></b><br>");

//Working including file cuteArray1.php which contains CuteArray class
echo("<hr color='blue' size=3><h2 align='center'><u>Working with Class <font color='red'>cuteArray1</font></u></h2>");

//Includung the class file

echo("<b>Working with Simple 1 dimensional Array<br>With default bullet</b>:");
$Obj1=new CuteArray($myChar);
echo("<b>With argument bullet :</b>");
echo("<b>With Choosed bullet and with Key :</b>");

echo("<hr color='tomato' size=4><b>Working with  MultiDimensional Array<br>With default bullet</b>:");
$Obj2=new CuteArray($characters);
echo ("<hr color='green' size=3><b>After adding a new assosiated array & Choosed bullet:</b>");
//adding new Array
$characters["I am"]=$myChar;
$Obj3=new CuteArray($characters);

Return current item: Array to List