Jump to content

Darkwoods

Members
  • Posts

    88
  • Joined

  • Last visited

Community Answers

  1. Darkwoods's post in How to convert text string into associative array using delimiters? was marked as the answer   
    Yes this is how I managed to do it but not so sure if it looks good..
    but it works
    $text = 'cat1=hello,world|cat2=one,two|cat3=value1,value2'; $arr= explode('|', $text); foreach($arr as $value) { $key = rtrim(stristr($value, '=', true), '='); $values = ltrim(stristr($value, '='), '='); $values = explode(',', $values); $array[$key] = $values; } print_r($array);  
     
     
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.