# Assoc Array to String & String to Assoc Array

Discussion in 'PHP' started by pradeep, Oct 17, 2005.

Joined:
Apr 4, 2005
Messages:
1,645
87
Trophy Points:
0
Occupation:
Programmer
Location:
Kolkata, India
``` //array to string  function arraytostr (\$array=array()) {         \$length = 0;       \$foreach (\$array as \$key => \$value) {            \$keystring .= "\$key ";            \$valuestring .= "\$value ";            \$length++;       }                 return array(\$length,\$keystring,\$valuestring);  }    //sting to array      function strtoarray (\$length="",\$keystring="",\$valuestring="") {            \$keys = explode(" ",\$keystring);            \$values = explode(" ",\$valuestring);            for (\$i=0; \$i < \$length; \$i++) {          \$key = \$keys[\$i];          \$newarray[\$key] = \$values[\$i];            }                      return \$newarray;  } ```
{"ft_lang_label":"__label__en","ft_lang_prob":0.5286974,"math_prob":0.94732386,"size":741,"snap":"2019-51-2020-05","text_gpt3_token_len":207,"char_repetition_ratio":0.17639077,"word_repetition_ratio":0.0,"special_character_ratio":0.32793522,"punctuation_ratio":0.19548872,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9807455,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-12-07T15:05:45Z\",\"WARC-Record-ID\":\"<urn:uuid:fd66eebd-ef71-43d9-b016-ad0edc0b0d49>\",\"Content-Length\":\"44461\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:46c177ba-9806-4331-b9fa-2b04732a8aa3>\",\"WARC-Concurrent-To\":\"<urn:uuid:eb5d6f12-9866-4ffd-85de-913a7c65de31>\",\"WARC-IP-Address\":\"173.230.137.46\",\"WARC-Target-URI\":\"https://www.go4expert.com/articles/assoc-array-string-string-assoc-array-t469/\",\"WARC-Payload-Digest\":\"sha1:MXTUTP2YISMLMCX4Q7ZVXYPZL3QCPOE7\",\"WARC-Block-Digest\":\"sha1:UT56ZYSL3G2DG7NP3WRHQ2LQVFQPJS4T\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-51/CC-MAIN-2019-51_segments_1575540499439.6_warc_CC-MAIN-20191207132817-20191207160817-00543.warc.gz\"}"}