* @link http://www.php.net/manual/en/class.arrayobject.php */ class CSVArrayObject extends StudipArrayObject { /** * Construct an array object from a string of comma separated items * * @param string $input a string of comma separated items */ function __construct($input) { if (is_string($input)) { $input = mb_strlen($input) ? array_map('trim', explode(',', $input)) : []; } parent::__construct((array)$input); } /** * magic method for use of object in string context * * @return string internal array itmes converted to a comma separated list */ function __toString() { return implode(',', $this->getArrayCopy()); } }