PHP ONE LINE CODE – U NEVER USED – array to comma separate string wrapped with character

Convert array value to string. String with comma separate value and wrapped both side with given character. Generate string without any long code but just using one line code.

PHP ONE LINE CODE - U NEVER USED - array to comma separate string wrapped with character
array to comma separate string wrapped with character

Here is simple and easy code sample for generate comma separate string with specific character.

$arrayOne = ['one', 'two'];
$str = implode(',', preg_filter('(^.*)', '#$0#', $arrayOne));
echo $str;
//OUTPUT
#one#,#two#

$arrayTwo = ['key1' => 'one', 'key2' => 'two'];
$str = implode(',', preg_filter('(^.*)', '#$0#', $arrayTwo));
echo $str;
//OUTPUT
#one#,#two#