Pike v8.0 release 1738

Method Array.arrayify()


Method arrayify

array arrayify(void|array|mixed x)

Description

Make an array of the argument, if it isn't already. An undefined argument gives the empty array. This is useful when something is either an array or a basic datatype, for instance in headers from the MIME module or Protocols.HTTP.Server.

Parameter x

Result depends of the argument type:

arrayp(x)

arrayify(x) => x

undefinedp(x)

arrayify(x) => ({})

otherwise

arrayify(x) => ({ x })