0

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 Answer 1

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) . "'";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.