map_string ( $pcre )

Maps each element in the CFArray object as a string.

Access

public

Parameters

Parameter

Type

Required

Description

$pcre

string

Optional

A Perl-Compatible Regular Expression (PCRE) to filter the names against.

Returns

Type

Description

array

The contents of the CFArray object mapped as strings. If there are no results, the method will return an empty array.

Source

Method defined in utilities/array.class.php | Toggle source view (17 lines) | View on GitHub

public function map_string($pcre = null)
{
    $list = array_map('strval', $this->getArrayCopy());
    $dlist = array();

    if ($pcre)
    {
        foreach ($list as $item)
        {
            $dlist[] = preg_match($pcre, $item) ? $item : null;
        }

        $list = array_values(array_filter($dlist));
    }

    return $list;
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback