Can someone help me out.
I'm looking for an solution how to check if in $testArray there is an array with ['value']['content'] == 1
I have tried:
$bool = in_array('1', array_column($testArray, 'content'));
var_dump($bool);
But than I get an return FALSE, but if you take a look at the testArray below you see the first array has ['value']['content'] => '1';
<?php
$testArray = array(
array(
'id' => '414-b9108bbe-66e3-4c1e-8a51-03b7b8a0d17c',
'position' => 0,
'type' => 'original',
'value' => array
(
'comment' => '',
'content' => '1',
'info' => '',
'insight' => '',
'label' => '',
'report' => '',
)
),
array(
'id' => '414-b9108bbe-66e3-4c1e-8a51-03b7b8a0d18c',
'position' => 0,
'type' => 'original',
'value' => array
(
'comment' => '',
'content' => '',
'info' => '',
'insight' => '',
'label' => '',
'report' => '',
)
),
);
echo '<pre>';
$bool = array_search('content', array_column($testArray, 'value'));
var_dump($bool);
echo '</pre>';
I think its because of the value is an other Array because i do:
$bool = in_array('original', array_column($testArray, 'type'));
Output: true.
&& $block['answer'][$which] === 1?$block['answer']and those arrays, sorry.answerwithin the array, but the examples you list don't mention it? Are you passing in the entire$testArray1or$testArray2as the input, or only a subset of the array?