To my friend with lots of love
<?php
class MyArray extends ArrayObject {
public function __construct($array = array()){
parent::__construct($array, ArrayObject::ARRAY_AS_PROPS);
}
public function get_property_string($sep = ':') {
return implode($sep, $this->getArrayCopy());
}
public function __ToString() {
return 'Array';
}
/* some custom method */
}
$rights = new MyArray;
$rights->append('LOGIN');
$rights->append('BETA_ACCESS');
$rights->append('WRITE_COMMENT');
var_dump($rights->get_property_string());
And the output will be:
string(31) "LOGIN:BETA_ACCESS:WRITE_COMMENT