function HTTP_Request::_flattenArray in Flickr API 5
Helper function to change the (probably multidimensional) associative array into the simple one.
@access private
Parameters
string name for item:
mixed item's values:
Return value
array array with the following items: array('item name', 'item value');
1 call to HTTP_Request::_flattenArray()
- HTTP_Request::_buildRequest in phpFlickr/
PEAR/ HTTP/ Request.php - Builds the request string
File
- phpFlickr/
PEAR/ HTTP/ Request.php, line 1006
Class
- HTTP_Request
- Class for performing HTTP requests
Code
function _flattenArray($name, $values) {
if (!is_array($values)) {
return array(
array(
$name,
$values,
),
);
}
else {
$ret = array();
foreach ($values as $k => $v) {
if (empty($name)) {
$newName = $k;
}
elseif ($this->_useBrackets) {
$newName = $name . '[' . $k . ']';
}
else {
$newName = $name;
}
$ret = array_merge($ret, $this
->_flattenArray($newName, $v));
}
return $ret;
}
}