Hello
I have something like this in a db field:
|1.jpg|2.jpg|3.jpg|4.jpg
Would someone mind telling me the PHP I should use in order to count the number of items and return that value? (in this case, 4)
Thanks very much 🙂
EDIT
I found this portion of code:
$screenshots = '';
if(!empty($ds['screens'])) $screens=explode("|", $ds['screens']);
if(is_array($screens)) {
$n=1;
foreach($screens as $screen) {
if(!empty($screen)) {
$screenshots.='<a href="images/clanwar-screens/'.$screen.'" rel="lightbox"><img src="images/clanwar-screens/'.$screen.'" style="width: 265px; height: 190px; border: 0; padding: 5px;" alt="" /></a>';
if($nbr==3) {$nbr=1; $screenshots.='<br />';}
else {$nbr=2;}
$n++;
}
}
}
if(!(mb_strlen(trim($screenshots)))) $screenshots= 'n/a';
Just in case it helps 😕