- var_export: documentation ( source)
- preg_split: documentation ( source)
<?php
$filepaths = '../images/box1/IMG_3158.JPG../images/box1/IMG_3161.JPG../images/box1/IMG_3163.JPG../images/box1/IMG_3158.JPG../images/box1/IMG_3161.JPG../images/box1/IMG_3163.JPG';
var_export(preg_split('/\.JPG\K(?!$)/', $filepaths));
echo "\n---\n";
var_export(preg_split('/(?!^)(?=\.\.)/', $filepaths));
echo "\n---\n";
var_export(preg_split('/\.JPG\K/', $filepaths, 0, PREG_SPLIT_NO_EMPTY));
echo "\n---\n";
var_export(preg_split('/(?!^)(?=\.\.)/', $filepaths, 0, PREG_SPLIT_NO_EMPTY));