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? Quote 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]"); Quote 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); Quote 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. Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.