Login   Register  
PHP Classes
elePHPant
Icontem

File: Example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Martin Lacroix  >  Simple Array  >  Example.php  >  Download  
File: Example.php
Role: Example script
Content type: text/plain
Description: Short example
Class: Simple Array
Manage arrays with keys of any type
Author: By
Last change:
Date: 2012-01-16 13:19
Size: 410 bytes
 

Contents

Class file image Download
<?php
include 'SimpleArray.php';

$a = new SimpleArray();
$a['123.456'] = 'string';  // the key is a string
$a[123.456]   = 'float';   // the key is a float
$a[]          = 'value';   // standard definition

// it's impossible to walk through it using foreach or each
// The right way is : 
$a->rewind();
while(
$a->valid()) {
   
// do some stuff using $a->key() and $a->current()
   
$a->next();
}