Search Results

Search found 1 results on 1 pages for '2by'.

Page 1/1 | 1 

  • PHP Count the lenght of each value in a array/string (tags)

    - by 2by
    Users writing an article have the option to write some tags, tags are written like this: tag1, tag2, tag3 So tags are stored like: $tags = "tag1, tag2, tag3"; I want to make sure, every tag has a minimum of 3 characters, so i need to validate the tags. I have tried this: $tagsstring = explode(",", $tags); $tagslength = array_map('strlen', $tagsstring); if (min($tagslength) < 3) { echo "Error... Each tag has to be at least 3 characters."; } It seems to work, sometimes... But of you write: tag1, df It wont give an error. Any suggestions?

    Read the article

1