Hey, I'm wondering how do to the following IF statement in PHP!
As you can see, I am wondering what the PHP equivalent for (begins with) and (contains) is. If it helps, the $variable is the user's client information (eg. Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461; .NET CLR 1.1.4322) because I want to show 1 thing to Mozilla/5.0 browsers such as Firefox 1.5.0.4 and another for Mozilla/4.0 browsers such as Internet Explorer 6. (I have worked out how to assign client information a variable, so i only need help with the if statements!)
Anyone that knows how to do this, or has a better way of going about it, please reply!
| Code: |
| if($variable (begins with) Mozilla/5.0){
print 'Hi!'; } if($variable (contains) Mozilla/4.0){ print 'Hello!'; } else{ print 'Boo!'; } (examples only) |
As you can see, I am wondering what the PHP equivalent for (begins with) and (contains) is. If it helps, the $variable is the user's client information (eg. Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461; .NET CLR 1.1.4322) because I want to show 1 thing to Mozilla/5.0 browsers such as Firefox 1.5.0.4 and another for Mozilla/4.0 browsers such as Internet Explorer 6. (I have worked out how to assign client information a variable, so i only need help with the if statements!)
Anyone that knows how to do this, or has a better way of going about it, please reply!
