Jump to content

How to Find a Character in a Variable


NoMansLand

Recommended Posts

Hello,

 

I am trying to find a character in my DB's.

 

The DB has the data setup with +(number) & -(number)

 

I want to try and find a way for PHP to seperate them into two so each one has the seperate colour's.

 

i have tried preg_match, strstr & strpos but none of them seem to work.

 

Can you as PHP Genius's help out?

 

EDIT:

 

Please Do Not Worry, I have fixed this.

 

For people who were wondering:

 

$new_variable = strstr($variable_to_check, "+");

if($new_variable == "") {

do one you want

} else {

do what you want.

}

 

Thanks PHP Freaks :)

 

Thanks,

 

NoMansLand

Link to comment
https://forums.phpfreaks.com/topic/232293-how-to-find-a-character-in-a-variable/
Share on other sites

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.