- print_r: documentation ( source)
- explode: documentation ( source)
- preg_replace: documentation ( source)
- array_walk: documentation ( source)
<?php
$allowedAttachmentTypes = '.jpeg,.gif,.png,.jpg,.bmp';
$allowedAttachmentTypes = array_walk( (explode( ',', $allowedAttachmentTypes )), function( $var, $index ) use ( &$allowedAttachmentTypes )
{
$allowedAttachmentTypes[ $index ] = preg_replace( '#[\s\.]+#', '', $var );
} );
print_r( $allowedAttachmentTypes );