From The Smartest Wiki
Jump to: navigation, search

SmartestArray is a wrapper for a PHP array, and can be counted and iterated with count() and foreach() just like a PHP array.

Note: This class is intended for use specifically for lists of like values or objects. The SmartestParameterHolder class, by contrast, is designed for general storage.

Its values can also be accessed as array offsets as if it were a PHP array. Pure PHP arrays however, lack the ability to be extended in terms of their functionality, especially in a template layer where it is not always feasible to add loads of Smarty functions. Much of this extra functionality, in addition to being available via ordinary methods, is available via the following offsets:


All built-in offsets for this class are preceded with an underscore to help prevent collisions with user defined data held in the array:

  • $obj._ids
  • $obj._data or $obj._items or $obj._objects
  • $obj._count
  • $obj._keys
  • $obj._first
  • $obj._last
  • $obj._empty
  • $obj._php_class