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.

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?

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.