1 2 3 4 5 6 7 8 9
| $str = '<image id="0">0169120000000805T01.JPG</image><image id="1">0169120000000805T02.JPG</image><image id="2">0169120000000805T03.JPG</image><image id="3">0169120000000805T04.JPG</image><image id="4">0169120000000805T05.JPG</image>' ;
$search = '@<[^>]*>@i';
$chaine = preg_replace( $search,',', $str);
// le resultat
// ,0169120000000805T01.JPG,,0169120000000805T02.JPG,,0169120000000805T03.JPG,,0169120000000805T04.JPG,,0169120000000805T05.JPG,
// donc un peu de nettoyage
echo str_replace( ',,', ',', trim( $chaine,','));
// resultat
// 0169120000000805T01.JPG,0169120000000805T02.JPG,0169120000000805T03.JPG,0169120000000805T04.JPG,0169120000000805T05.JPG |
Partager