Jump to content

[SOLVED] in_array ?


MemphiS

Recommended Posts

I keep getting the following error:

 

Warning: in_array() [function.in-array]: Wrong datatype for second argument in

 

Code example:

$post1 = $_POST['number1'];
$post2 = $_POST['number2'];
$post3 = $_POST['number3'];

$array1 = array("1","2","3");
$array2 = array("$post1","$post2","$post3");
$array3 = array("1","2","3","$post1","$post2","$post3");

if (in_array("1", $array2)){ print("1 has been found."); }
if (in_array("1", $array3)>2){ print("1 has been found twice in array 3."); }

 

Once the POST values have been set its fine... and when not set they have no value and dispplays the above error... is there a solution to overcome this problem?

Link to comment
https://forums.phpfreaks.com/topic/53845-solved-in_array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.