i have an array like in PHP:
$a = array('110','111','121');
i want to convert it to :
$b = " '110' , '111' , '121' ";
is there any function in PHP that does it? i know it could be done with a loop on array and put value in $b, but i want a less more code solution.
thank you.
You do need all those spaces and quotes? You can still use
implode, althougharray_reducemight be nicerarray_reduce:Advantage of
array_reduce, is that you will get NULL for an empty array, instead of''. Note that you cannot use this inline function construct in php versions prior to 5.3. You’ll need to make the callback a separate function and pass its name as a string to array_reduce.