Reputation: 11
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'
Upvotes: 0
Views: 165
Reputation: 53563
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) . "'";
Upvotes: 1