function fp_explode_assoc

6.x misc.inc fp_explode_assoc($string, $delim = ",", $assign_sep = "_S-")
5.x misc.inc fp_explode_assoc($string, $delim = ",", $assign_sep = "-")

Takes a string (created by fp_join_assoc()) and re-creates the 1 dimensional assoc array.

See also

fp_join_assoc()

1 call to fp_explode_assoc()
_Course::load_course_from_data_string in classes/_Course.php
This will take a data string, as created by the function to_data_string(), and make $this object match the original object. It is a poor man's unserialize. See to_data_string()'s description for a fuller picture of what is going on.

File

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

Code

function fp_explode_assoc($string, $delim = ",", $assign_sep = "-") {
  $rtn = array();

  $temp = explode($delim, $string);
  foreach ($temp as $line) {
    $line = trim($line);
    if ($line == "") {
      continue;
    }

    $temp2 = explode($assign_sep, $line);
    if (is_numeric($temp2 [1])) {
      $temp2 [1] = $temp2 [1] * 1; // if its numeric anyway, make it have a numeric type.      
    }

    $rtn [$temp2 [0]] = $temp2 [1];

  }

  return $rtn;
}