Jump to content

[SOLVED] Searching a String


ballouta

Recommended Posts

Do you want to know if this variable contains that certain substring? Do you want to know where? Do you want the text around it?

 

I assume you only need to check whether $email_comments contains "processed successfully". This is done (in the most simple way) like that:

 

<?php

$email_comments = "...text...processed successfully...text...";

if(strpos($email_cmments, "processed successfully") !== FALSE)
echo "It was processed successfully";
else
echo "It wasn't processed successfully";

?>

 

Orio.

Link to comment
Share on other sites

Hi

 

this is the code

$email_comments = "Dear Customer, Thank you for placing an order for RPL file.
Your order was processed successfully. Please find the zip file attached to this mail
which contains both original Nokia and NSS files.";

if(strpos($email_cmments, "processed successfully") !== FALSE)
echo "It was processed successfully";
else
echo "It wasn't processed successfully";

 

The output is :It wasn't processed successfully

I also tried to add a point to the "processed successfully." but the same.

 

why?

Link to comment
Share on other sites

Orio accidentily mis-spelled "comments" xD

 

$email_comments = "Dear Customer, Thank you for placing an order for RPL file.
Your order was processed successfully. Please find the zip file attached to this mail
which contains both original Nokia and NSS files.";

if(strpos($email_comments, "processed successfully") !== FALSE)
echo "It was processed successfully";
else
echo "It wasn't processed successfully";

 

Try that.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.