PHP Classes

File: Test.php

Recommend this page to a friend!
  Classes of Bao Nguyen Quoc   Magic Array   Test.php   Download  
File: Test.php
Role: Example script
Content type: text/plain
Description: Test file
Class: Magic Array
Provide enhanced array functionality
Author: By
Last change:
Date: 16 years ago
Size: 491 bytes
 

Contents

Class file image Download
<?php

require_once "MagicArray.php";

$array = new MagicArray(); // now you can work with this object as an array

$array[] = 'test';
$array['Test'] = 'hello world';

echo
"count : " . count($array) . "<br/>"; // 2

reset($array); // 'test'
next($array); // 1

echo "Current : " . current($array) . "<br/>";

echo
"array[test] : " . $array['test'] . "<br/>"; // index is case in-sensitive

$array->remove('hello world'); // easier to remove value

print_r($array);

?>