I have two arrays:
$ keys
Array
(
[0] => Array
(
[0] => {3}
[1] => {1}
[2] => {2}
[3] => {0}
[4] => {4}
[5] => {5}
)
);
$ properties
Array
(
[0] => Array
(
[0] => var::terms::
[1] => var::create_terms >> 1::
[2] => const::EXAMPLE123::
[3] => var::create_terms>>0::
[4] => text::serio mesmo::
[5] => ::ENTER::
)
... // outras keys que não estão relacionadas
)
And I would like to know which way is most correct and recommended in terms of perfomance and semantics, check the existence of the values of array 1 (without% with brackets%) in the keys of array 2 ( I have two examples )
$keys[1] = array_map(function ($keys) {
return str_replace(['{', '}'], null, $keys);
}, $keys[0]);
sort($keys[1]);
if (in_array($keys[1], [array_keys($properties[0])], false)) {...} else {...}
OR
$keys[1] = array_map(function ($keys) {
return str_replace(['{', '}'], null, $keys);
}, $keys[0]);
foreach ($keys[1] as $key) {
if (array_key_exists($key, $properties[0])) {...} else {...}
}