The in_array function works inconsistently

This is a discussion on The in_array function works inconsistently within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, The in_array function sometimes malfunctions on my computer yielding the error message shown below. The code shown below usually ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2004
Mountain Man
 
Posts: n/a
Default The in_array function works inconsistently

Hi,

The in_array function sometimes malfunctions on my computer yielding
the error message shown below. The code shown below usually works, but
sometimes doesn't. This even happens with the same instance of code.
Different results on different times I load the same page. Can anyone
explain what's going on here?

Best wishes,

Mountain Man
============

Warning: in_array(): Wrong datatype for second argument on line 1.

if (in_array(Yes, $like)) { $like2 = Yes; }
elseif (in_array(No, $like)) { $like2 = No; }
Reply With Quote
  #2 (permalink)  
Old 02-27-2004
Erwin Moller
 
Posts: n/a
Default Re: The in_array function works inconsistently

Mountain Man wrote:

> Hi,
>
> The in_array function sometimes malfunctions on my computer yielding
> the error message shown below. The code shown below usually works, but
> sometimes doesn't. This even happens with the same instance of code.
> Different results on different times I load the same page. Can anyone
> explain what's going on here?
>
> Best wishes,
>
> Mountain Man
> ============
>
> Warning: in_array(): Wrong datatype for second argument on line 1.
>
> if (in_array(Yes, $like)) { $like2 = Yes; }
> elseif (in_array(No, $like)) { $like2 = No; }


Hi Mountainman,

What excactly is Yes and No?
Didn't you mean a variable $Yes or a string "Yes" ??

Regards,
Erwin Moller
Reply With Quote
  #3 (permalink)  
Old 02-27-2004
Mountain Man
 
Posts: n/a
Default Re: The in_array function works inconsistently

> Hi Mountainman,
>
> What excactly is Yes and No?
> Didn't you mean a variable $Yes or a string "Yes" ??
>
> Regards,
> Erwin Moller


Hi Erwin,

I meant a string "Yes."

Best wishes,

Mountain Man
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:20 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0