Re: [rjbathgate] PHP IF with wildcard
Hi Rob,
Yes, it's totally different in PHP then in MySQL. There's a list of string functions here: http://ca.php.net/manual/en/ref.strings.php
And much more advanced pattern matching functions called "Regular Expressions" that you can learn about that let you do this kind of thing (google for details).
But to keep it simple for now I'd just use this function: http://www.php.net/stripos
Try this:
<?php if (stripos("abc", $_GET['submitted']) !== false): ?>
Found submitted value in "abc" string.
<?php endif ?>
Basically it looks for the second value in the first value. If it find it it returns the offset (0, 1, 2, etc) or false if no match. Hope that helps, let me know if you need more details.
Dave Edis - Senior Developer
interactivetools.com