Hey guys got an issue with the in_array not returning true.
my code is as follows:
if ( in_array( 'item_name', $this->conditions ) ) {
print "test";
}
this is just a test code. the $this->conditions is set in someplace else in the files and it looks like this:
Array
(
[0] => Array
(
[operator] =>
[property] => item_name
[logic] => contains
[value] => the age
)
)
its not printing the "test"; what am i doing wrong ?
var_dump added below:
array (size=2)
0 =>
array (size=4)
'operator' => string '' (length=0)
'property' => string 'item_name' (length=9)
'logic' => string 'contains' (length=8)
'value' => string 'the age' (length=7)
1 =>
array (size=4)
'operator' => string 'or' (length=2)
'property' => string 'item_name' (length=9)
'logic' => string 'ends' (length=4)
'value' => string 'malouf' (length=6)
$this->conditionsis an object you can verify usingis_object()function.$this->conditions[0]will do for you.