Jump to content

[SOLVED] PHP - Extracting a word from a string


Wildhalf

Recommended Posts

Hi

 

I have been looking it up but cant come up with the code to extract a word from a string.

 

example : "Hi There I am Kieron"

 

I want to extract "Kieron"

 

It doesn't matter really if the returned value equals what i am looking for a True or False would do. But it would be handy if i could.

 

Kieron

Thanks for your replys....

 

I just figured it out.... The following works for me

 

I used ereg()

 


<?

$referrer = $_SERVER['HTTP_REFERER']; 

//echo "$referrer";
echo $referrer;
echo '<br />';

ereg ("Kieron", $referrer, $domain);

If ($domain[0] == 'Kieron'){
echo 'This works </br>';
}

echo $domain[0]; // prints @example.com

?>


 

Is that going to be the same for anyway you do it??

 

Unless you create a variable.

 

I am really using it to make sure my customers have paid me via paypal. For what i am doing i cannot encrypt my paypal subscription buttons (Im not going into why). Therefore my return URL will be displayed.

 

I will search for the string "paypal.com" and with this code in place it checks to see if the server who sent the user there was paypal or not.

 

If so it will display my signup/download link or else dispay an error message telling them they did not pay.

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.