WireArray::implode() method

Combine all elements into a delimiter-separated string containing the given property from each item

Similar to PHP's implode() function.


// basic usage
$string = $wireArray->implode(string $delimiter);

// usage with all arguments
$string = $wireArray->implode(string $delimiter, $property = '', array $options = []);



The delimiter to separate each item by (or the glue to tie them together). If not needed, this argument may be omitted and $property supplied first (also shifting $options to 2nd arg).

property (optional)string, callable

The property to retrieve from each item, or a function that returns the value to store. If a function/closure is provided it is given the $item (argument 1) and the $key (argument 2), and it should return the value (string) to use. If delimiter is omitted, this becomes the first argument.

options (optional)array

Optional options to modify the behavior:

  • skipEmpty (bool): Whether empty items should be skipped (default=true)
  • prepend (string): String to prepend to result. Ignored if result is blank.
  • append (string): String to append to result. Ignored if result is blank.
  • Please note that if delimiter is omitted, $options becomes the second argument.

Return value


See Also

WireArray methods and properties

API reference based on ProcessWire core version 3.0.185

Twitter updates

  • ProcessWire 3.0.192 (dev branch) contains 11 issue fixes and 5 pull requests, over 20 commits— More
    7 January 2022
  • ProcessWire 3.0.191 core updates: updates to the installer and the profile exporter module— More
    24 December 2021
  • This week ProcessWire went on a diet, trimming the core size from 15.5 MB down to 7.5 MB by moving optional site profiles into their own GitHub repos— More
    17 December 2021

Latest news

  • ProcessWire Weekly #402
    In the 402nd issue of ProcessWire Weekly we'll check out ProcessWire 3.0.193, highlight recent ProcessWire projects and resources, and more. Read on!
    Weekly.pw / 22 January 2022
  • ProcessWire 3.0.190 core updates
    ProcessWire 3.0.190 has 15 commits relative to 3.0.189 and contains a mixture of issue resolutions and feature additions. This post covers them all, in addition to updates for the PageAutosave and ProFields Table modules.
    Blog / 3 December 2021
  • Subscribe to weekly ProcessWire news

“Indeed, if ProcessWire can be considered as a CMS in its own right, it also offers all the advantages of a CMF (Content Management Framework). Unlike other solutions, the programmer is not forced to follow the proposed model and can integrate his/her ways of doing things.” —Guy Verville, Spiria Digital Inc.