I have this $fields array:
Array
(
[0] => Array
(
[field] => Name
[condition] => 0
[value] => abc
)
[1] => Array
(
[input] => Username
[condition] => 1
[value] => xyz
)
[2] => Array
(
[input] => Email
[condition] => 1
[value] => xyz@gmail.com
)
...
)
condition 0 is equals to and condition 1 is is not equals to. How can i note that all the matches.
I need to echo something if only all of the condition matches. I mean if value is abc for name and value is not xyz for username and value is not xyz@gmail.com for email field..
foreach( $fields as $field ) {
if( $field['condition'] == 0 ) {
if( $field['value'] == 'value_from_input') {
echo 'something';
}
}
elseif( $field['condition'] == 0 ) {
if( $field['value'] == 'value_from_input') {
echo 'something';
}
}
}
However this seems to be OR condition, if any matches there is a echo. I need all the conditions to match.
Regards,
Aucun commentaire:
Enregistrer un commentaire