Tag Archives: String

3 functions to check if string contains specific words

check for existence of a substring into a string is a common requirement for programmers. Here I’m describing 3 functions to check if string contains specific words.
  • strpos – Find the position of the first occurrence of a substring in a string.
  • strstr – Find the first occurrence of a string
  • preg_match – Perform a regular expression match

Continue Reading ››

finding values in comma separated string using mysql

Generally, We give the various options of choices to choose on websites in form of checkbox and stores various values of choices in a column of MySQL database as a comma seperated . For example we store user’s preferred hobby in user table’s hobbies(varchar(250)) field(column). Value stored in this field may be like 1,2,5,6,1 or may be ‘sports’,’gardening’,’cooking’,’reading’.

Continue Reading ››