User Tools

Site Tools


dev:plugin:helpers

Table of Contents

Helpers

Provides currently only ArrayOfObject helper.

ArrayOfObj

Can be used to sort Array of Object by property

Public methods:

ArrayOfObj::sortAsc(&array, "property");
ArrayOfObj::sortDesc(&array, "property");

Example usage

$array = array(new myObj("test", 123), new myObj("test", 321));
ArrayOfObj::sortAsc($array, "time");
 
foreach($array as $obj) {
 echo $obj->name . "->" $obj->time;
}
 
 
class myObj {
 public $time;
 public $name;
 
  function __construct($name, $time) {
  $this->name= $name;
  $this->time = $time;
  }
 
}
dev/plugin/helpers.txt · Last modified: 2013/07/17 10:08 (external edit)