<?php
$pattern = '/,\s?/';
$filenames = 'filename.png,filename.png,filename.png,filename.png,file name.png';
var_dump(preg_split($pattern, $filenames));
$filenames = 'filename.png, filename2.png, filename3.png, filename4.png, file name5.png';
var_dump(preg_split($pattern, $filenames));
- Output for 7.0.0 - 7.0.25, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- array(5) {
[0]=>
string(12) "filename.png"
[1]=>
string(12) "filename.png"
[2]=>
string(12) "filename.png"
[3]=>
string(12) "filename.png"
[4]=>
string(13) "file name.png"
}
array(5) {
[0]=>
string(12) "filename.png"
[1]=>
string(13) "filename2.png"
[2]=>
string(13) "filename3.png"
[3]=>
string(13) "filename4.png"
[4]=>
string(14) "file name5.png"
}
preferences:
41.14 ms | 408 KiB | 5 Q