webCOMAND

collection::as_array()

Return the objects, or value of a specific field of each object, in this collection as an array.  If no field identifier is specified, the returned array will include all objects in the collection.  If a field identifier is specified, the returned array will include the value of that field from each object in the collection.

The order of the objects or field values in the array will be consistent with the order of the corresponding objects in the collection.

Prototype

array as_array(string $field_identifier = NULL)

Return

An array of objects or field values for each object in the collection.

Example

$objects = $collection->get("WHERE Identifier LIKE '%System%'");

$object_array = $objects->as_array();
echo("Objects: " . implode(',', $object_array) . "\n");

$value_array = $objects->as_array('OID');
echo("OIDs: " . implode(',', $value_array) . "\n");

Related

collection::as_associative_array(), collection::field_values(), collection::unique()