M
M
Maxim Stikharev2018-02-28 09:50:20
PHP
Maxim Stikharev, 2018-02-28 09:50:20

Why doesn't continue work?

There is a piece of code that should turn off the loop if the product element is not in the array

$accepted_names = array('FSA','Deda Elementi','Stronglight');
$testing_vendor = $arItem['BIKE_BRAND'];
if (in_array($accepted_names, $testing_vendor) === false)
  continue;

$arItem['BIKE_BRAND'] - returns a string value, for example Test.
But, for some unknown reason, this script does not skip the loop when it does not find a manufacturer in the array

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2018-02-28
@maximifn

Where is the cycle? Figure out how he looks?
What does cycle skip mean? It should only skip one iteration, not all.
var_dump to help, anything can be in Bitrix.
Insert curly braces.
in_array the first argument is what we are looking for, not where we are looking for.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question