I am trying to check if these following 2 var values exist in the "$query_string_params_and_values_white_list" array or not.
//Values to check:
$table = 'users';
$column = 'kites';
//Array:
$query_string_params_and_values_white_list = array('table'=>array('users','members'),array('column'=>array('keyword','phrase')));
On my test, I get echoed ...
'no exists' 'no exists'
Since the first var value does exist in the array then my result echo should've been:
'exists' 'no exists'
But since I got undesired result it means my code is faulty.
Here is my code ...
$query_string_params_and_values_white_list = array('table'=>array('users','members'),array('column'=>array('keyword','phrase')));
$table = 'users';
$column = 'kites';
if(in_array("$table",$query_string_params_and_values_white_list))
{
echo 'exists';
}
else
{
echo 'no exists';
}
if(in_array("$column",$query_string_params_and_values_white_list))
{
echo 'exists';
}
else
{
echo 'no exists';
}
Where did I go wrong ? Am checking in array instead of sub-array. Correct ? If so, then how to check sub array ?
Can you show me how I should've coded it ?
Thanks!