You are here

public static function Braintree_Util::implodeAssociativeArray in Commerce Braintree 7

Parameters

array $array associative array to implode:

string $separator (optional, defaults to =):

string $glue (optional, defaults to ', '):

3 calls to Braintree_Util::implodeAssociativeArray()
Braintree_Instance::__toString in braintree_php/lib/Braintree/Instance.php
create a printable representation of the object as: ClassName[property=value, property=value]
Braintree_Util::attributesToString in braintree_php/lib/Braintree/Util.php
Braintree_UtilTest::testimplodeAssociativeArray in braintree_php/tests/unit/UtilTest.php

File

braintree_php/lib/Braintree/Util.php, line 153

Class

Braintree_Util
Braintree Utility methods

Code

public static function implodeAssociativeArray($array, $separator = '=', $glue = ', ') {

  // build a new array with joined keys and values
  $tmpArray = null;
  foreach ($array as $key => $value) {
    $tmpArray[] = $key . $separator . $value;
  }

  // implode and return the new array
  return is_array($tmpArray) ? implode($glue, $tmpArray) : false;
}