See www.php.net/in_array in the user manual, and notice that it has 2 required parameters and a 3rd optional parameter.
However, at this point I'm not sure what array you would be wanting to check at that point, anyway?
Last edited by NogDog; 02-20-2013 at 01:22 PM.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
The website owner wanted a visitor counter, but I didn't want some robots counted so I wanted to check the HTTP_USER_AGENT of those accessing the website to see if they were in the array and if so they would not be added to the visitor count.
So you just want to add $losers as the 2nd parameter, right?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Yes, I believe the page you linked to said that the second parameter was the array to be searched, which would be $losers.
I used "if (!in_array($user_agents, $losers, true))" which I took to mean - "if not in array" or if this HTTP_USER_AGENT is not listed in this array ($losers).
Sounds right, to me. If you have the User Agent Switcher add-on in Firefox, it should be pretty easy to test and make sure.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks