Solved

find string

Posted on 2009-05-06
1
131 Views
Last Modified: 2012-05-06
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
Comment
Question by:XK8ER
1 Comment
 
LVL 19

Accepted Solution

by:
Michael701 earned 500 total points
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now