Jump to content

if string contains


dreamwest

Recommended Posts

If i have 2 strings:

 

1234

 

and

 

HD1234

 

How can i tell php to only use "HD1234"

 

be more specific.  Are you meaning to say that sometimes the string might be 1234 and sometimes it might be HD1234 and you only want to do something if it's HD1234?

Link to comment
https://forums.phpfreaks.com/topic/142877-if-string-contains/#findComment-749073
Share on other sites

Are you meaning to say that sometimes the string might be 1234 and sometimes it might be HD1234 and you only want to do something if it's HD1234?

 

Yes. Only if it has "HD" in the string.

 

Is there a contains function like this??

 

if str_contains("HD"){

Then do it

}else{ Dont do it
}

 

 

Link to comment
https://forums.phpfreaks.com/topic/142877-if-string-contains/#findComment-749115
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.