I'm quite new to PHP, and am trying to follow a book example of something. The sample code in the book includes the following snippet:
$names = array ("Lee Marvin","Joe Smith","John Doe");
if (!in_array (strtolower ($_GET['sstring']), strtolower($names))){
//Then return with an error.
?><span style="color: #FF0000;">Name not found...</span><?php
} else {
//At this point we would go to the processing script.
?><span style="color: #FF0000;">Form would now submit...</span><?php
}
This code returns the error, "Warning: in_array() [function.in-array]: Wrong datatype for second argument," in reference to the in_array statement. If I remove the second strtolower function, all works well. So my question is, how do I do the case conversion on the array to ensure proper matching? The idea of the code is to allow LEE MARVIN, lEE marVin, etc., to match with Lee Marvin. Help and thanks.