I'm trying to display results in a foreach loop.
I have an array like so:
$slides = array(
1 => $params->get('param_1'),
2 => $params->get('param_2'),
3 => $params->get('param_3')
);
If a parameter in the backend is set to yes, the value equals 1, and thus a result is displayed.
So what I'm trying to write is, foreach array value that is equal to 1
I'm aware that I can't use something like this:
foreach (slides == 1) {
// echo stuff here
}
How would I write this foreach loop? Any help or guidelines would be highly appreciated
foreachloop at all. You want to iterate over each element. The issue is to test the value of each item in the array and only if it answers a certain condition, then you output it.