Skip to content

tp TouchPointWP Utilities StringableArray

James K. edited this page Jun 26, 2024 · 5 revisions

tp\TouchPointWP\Utilities\StringableArray

A collection of things that can be cast to a string by gluing them together with a simple implode().

  • Class name: StringableArray
  • Namespace: \tp\TouchPointWP\Utilities
  • Parent class: ArrayObject

Methods

__construct

mixed tp\TouchPointWP\Utilities\StringableArray::__construct(string separator, object|array array, int flags, string iteratorClass)

StringableArray constructor.

  • Visibility: public

Arguments

  • separator string* array object|array* flags int* iteratorClass string

Returns

  • mixed

count

int tp\TouchPointWP\Utilities\StringableArray::count()

Length of array.

  • Visibility: public

Returns

  • int -

prepend

mixed tp\TouchPointWP\Utilities\StringableArray::prepend(mixed value)

Append to the end of the array.

  • Visibility: public

Arguments

  • value mixed

Returns

  • mixed

contains

bool tp\TouchPointWP\Utilities\StringableArray::contains(mixed needle)

Determine if the stringable array (haystack) contains the given needle

  • Visibility: public

Arguments

  • needle mixed

Returns

  • bool -

__toString

string tp\TouchPointWP\Utilities\StringableArray::__toString()

Standard method to stringify.

  • Visibility: public

Returns

  • string -

join

string tp\TouchPointWP\Utilities\StringableArray::join(string|null separator)

Link the items together with a given separator, which may be different from the separator used in the constructor.

  • Visibility: public

Arguments

  • separator string|null

Returns

  • string -

toListString

string tp\TouchPointWP\Utilities\StringableArray::toListString()

Convert the array to a list string with ampersands and such.

  • Visibility: public

Returns

  • string -
Clone this wiki locally