Hi,
I'm trying to do a few basic things in PHP, problem being i am used to tweaking other's code rather than writing it from scratch so im having a few problems. The first thing i'd like to do is create a statement saying IF foo then echo bar, the problem being that the string containing foo also has a lot of other bits in it that id like to ignore. Here's an example, i have a combobox with lots of addresses, like so:
AAA - Mr Test, Test Town, Testshire, AA11 1AA
AAA - Another Test, No Reason, Just Felt Like It, BB1 1AB
BBB - Test again, But this time with a different beginning, AA12 3DB
What i'd like to do is say IF any part of that string matches AAA then echo "Some statement about AAA", or IF any part of that string matches BBB then echo "A different statement about BBB". I have about 8 different "zones" and this is what these "AAA" refer to.
So basically, how do i code that in PHP? I know how to do a basic IF statement, just not how to search for a certain bit of text in a string? There's more to come but this is my starting block.
TIA
I'm trying to do a few basic things in PHP, problem being i am used to tweaking other's code rather than writing it from scratch so im having a few problems. The first thing i'd like to do is create a statement saying IF foo then echo bar, the problem being that the string containing foo also has a lot of other bits in it that id like to ignore. Here's an example, i have a combobox with lots of addresses, like so:
AAA - Mr Test, Test Town, Testshire, AA11 1AA
AAA - Another Test, No Reason, Just Felt Like It, BB1 1AB
BBB - Test again, But this time with a different beginning, AA12 3DB
What i'd like to do is say IF any part of that string matches AAA then echo "Some statement about AAA", or IF any part of that string matches BBB then echo "A different statement about BBB". I have about 8 different "zones" and this is what these "AAA" refer to.
So basically, how do i code that in PHP? I know how to do a basic IF statement, just not how to search for a certain bit of text in a string? There's more to come but this is my starting block.
TIA
Last edited: