0

I have the input array in following format:

"123,46,78,000";

But I need it in this format:

'123','46','78','000';

can any one help me?

1 Answer 1

1

Let's devide this string into the array.

$var = "123,46,78,000"; $array = explode(',',$var); 

after that we can merge all array into string using implode function.

$finaloutput = "'" . implode ( "', '", $array ) . "'"; echo $finaloutput; 

now, you will get the exact output which you need.

I hope this will solve your problem.

Thanks,

2
  • Its solve my issue ,I got a output as expected,Thank you so much . Commented Apr 29, 2020 at 14:11
  • Welcome @kanidhaya Commented Apr 30, 2020 at 4:44

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.