killah Posted July 29, 2009 Share Posted July 29, 2009 What i want to do is limit the amount of image's a user can use, thus i need to check the amount of inside the bbcode signature. Any idea's? Link to comment https://forums.phpfreaks.com/topic/168037-solved-grab-the-amount-of-img-in-a-bbcode-signature/ Share on other sites More sharing options...
.josh Posted July 29, 2009 Share Posted July 29, 2009 $c = substr_count(strtolower($content),"[img]"); Link to comment https://forums.phpfreaks.com/topic/168037-solved-grab-the-amount-of-img-in-a-bbcode-signature/#findComment-886374 Share on other sites More sharing options...
killah Posted July 30, 2009 Author Share Posted July 30, 2009 This is how i worked it out rather: $string = explode('', $_POST['signature']); $count = (count($string) - 1); Link to comment https://forums.phpfreaks.com/topic/168037-solved-grab-the-amount-of-img-in-a-bbcode-signature/#findComment-886672 Share on other sites More sharing options...
.josh Posted July 30, 2009 Share Posted July 30, 2009 sure, that will work. Except I'm not sure why you are subtracting 1 from the count...unless you have some sort of loop thing going on after that, I guess. Link to comment https://forums.phpfreaks.com/topic/168037-solved-grab-the-amount-of-img-in-a-bbcode-signature/#findComment-886821 Share on other sites More sharing options...
killah Posted August 4, 2009 Author Share Posted August 4, 2009 I subtracted 1 from the count as it was showing some what like this: Array ( [0] => [1] => firstimage[/img] [2] => secondimage[/img] ) So i had to remove 1 as [0] ain't supposed to be counting. Link to comment https://forums.phpfreaks.com/topic/168037-solved-grab-the-amount-of-img-in-a-bbcode-signature/#findComment-890536 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.