问题
How implode array element into single string in php
$name = array( 'id', "no", "date",'fadd');
echo implode("','",$name);
I am looking for the output is
'id', 'no', 'date', 'fadd'
回答1:
You've got the implode part right, just explicitly echo a quote before and after to get the leading and trailing characters:
$name = array( 'id', "no", "date",'fadd');
echo "'" . implode("','",$name) . "'";
来源:https://stackoverflow.com/questions/25874932/how-implode-array-elements-in-php