I have array like this
$test=Array ( [0] => en [1] => fr )
when I use this command
$a=implode(",",$test);
print_r($a);
result is:
en,fr
but I want this result
'en','fr'
This could be an option:
$a = implode(",", array_map(function($el) {return "'" . $el . "'";}, $test));
This approach focuses on readability and generality. You could have another transformation for each array element, using an anonymous function, before imploding.