function fp_join_assoc

6.x misc.inc fp_join_assoc($arr, $glue = ",", $assign_sep = "_S-")
5.x misc.inc fp_join_assoc($arr, $glue = ",", $assign_sep = "-")

This function will create a string from a 1 dimensional assoc array. Ex: arr = array("pet" => "dog", "name" => "Rex") will return: pet-dog,name-Rex under the default settings.

Use the fp_explode_assoc function to piece it back together.

See also

fp_explode_assoc

1 call to fp_join_assoc()
_Course::to_data_string in classes/_Course.php
This function will create a "data string" of the course. Think of it as a poor man's serialize. I can't actually use serialize, as I have to call this for every course on the screen, and the page load time was too long when using…

File

includes/misc.inc, line 1141
This file contains misc functions for FlightPath

Code

function fp_join_assoc($arr, $glue = ",", $assign_sep = "-") {
  $rtn = "";

  foreach ($arr as $key => $val) {
    $rtn .= $key . $assign_sep . $val . $glue;
  }

  // Should be an extra glue character at the end we need to trim off.
  $rtn = rtrim($rtn, $glue);

  return $rtn;
}