LemonInflux Posted November 6, 2007 Share Posted November 6, 2007 Hello, all. My query is this: Say I have a string like this: $var = afboij|abfouhenh|naxcbejkh|lkj Just random letters, but separated by a |. How do I count the number of |s in the string? Quote Link to comment Share on other sites More sharing options...
Barand Posted November 6, 2007 Share Posted November 6, 2007 <?php $var = 'afboij|abfouhenh|naxcbejkh|lkj'; echo substr_count($var, '|'); // 3 ?> Quote Link to comment 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.