• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 142
  • Last Modified:

find string

hello there,
how can I make something so that if strings like these

'successfully submitted'
'Thank you for submitting'
'submitted successfully'

are found in a data to echo success..
0
XK8ER
Asked:
XK8ER
1 Solution
 
Michael701Commented:
guess you could just use strpos to see if the string is in the data

there is probably a better preg_grep but I'm not an expert with them

if (strpos($data, 'successfully submitted')!==false or strpos($data, 'Thank you for submitting')!==false or strpos($data, 'submitted successfully')!==false)
{
  echo "success";
}

// !== false is a special check to make 'not found' different the 'found start of data' which returns a zero
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now