简体   繁体   中英

How to get the multiple array values into explode function?

I am getting these values from a database.

$Generic=$res['Generic'];
$Trade=$res['Trade'];
$Dos=$res['Dos'];
$Duration=$res['Duration'];

I stored the values using implode function. How to get these values into explode function?

Just call explode with the same separator you used for implode :

$foo=array(1,2,3,4);

$imploded=implode('|', $foo);

$restored=explode('|', $imploded);

Using implode causes losing named index information (only the sequence of variables in array matters - so variables would be on indexes 0, 1 and so on). If you want to keep named indexes use serialize.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM