PHP turns an array into a string implode and explode

Source: Internet
Author: User
If it is simply merging, it is simple:
$new = Implode (', ', Array (' A ', ' B ', ' C ', ' d ', ' e ', ' f ', ' G ')); 

However, if you consider the recovery of the group, so be sure to use the separator to do it, or you can not get out ah ...

the merged and removed code is as follows:
<?php
//The array is synthesized into a variable, with a | character-lattice;
$new =implode ("|", Array (a,b,c,d,e,f,g));

echo "Variable value is:";
echo $new;
echo "<br>\n";

Split the variable into an array
$b =explode (' | ', $new);
The value of the foreach ($b as $key => $value) {
echo array $key = $value <br>\n ";}
? > 

serialize and Unserialize can also be merged and disassembled, but the data is a bit longer.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.