RE: [PHP] in_array problems (another pair of eyes?)
| From: | Johnson, Kirk | Date: | Wed, 22 May 2002 14:22:47 +0000 |
| Subject: | RE: [PHP] in_array problems (another pair of eyes?) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-98740@lists.php.net to get a copy of this message | ||
Unless you are using PHP version 4.2 or higher, the first argument can't be
an array.
Kirk
> -----Original Message-----
> From: Jas [mailto:jlgerfen@hotmail.com]
> Sent: Tuesday, May 21, 2002 11:46 AM
> To: php-general@lists.php.net
> Subject: [PHP] in_array problems (another pair of eyes?)
>
>
> I don't think I am using the syntax correctly, I have been
> looking at this
> function on php.net and everything I have seen says my code should be
> working.
> A form allows the user to upload a file:
> <form name="img1" method="post" action="upload_done.php"
> enctype="multipart/form-data">
> <input type="file" name="img1" size="25">
> <input type="submit" name="Submit" value="save">
> <input type="reset" name="reset" value="reset">
> </form>
> Resulting file (upload_done.php):
> <?php
> $types = array(".gif",
> ".jpg",
> ".jpeg",
> ".htm",
> ".pdf"); //place file type into array
> if (in_array(array ('.jpg', '.jpeg'), $types)) { //this is
> the error line
> (line 7)
> print "jpg file"; }
> ?>
> And here is my error:
> Warning: Wrong datatype for first argument in call to in_array in
> upload_done.php on line 7