<?php $resultArray = [ [ 'nid' => [ [ 'value' => 1, ] ], 'vid' => [ [ 'value' => 2, ] ], 'cid' => [ [ 'value' => 3, ] ], 'field' => [ [ 'target_id' => 4, ] ], ], [ 'nid' => [ [ 'value' => 11, ] ], 'vid' => [ [ 'value' => 22, ] ], 'cid' => [ [ 'value' => 33, ] ], 'field' => [ [ 'target_id' => 44, ] ], ], ]; $test = 1; foreach ($resultArray as $items) { // Echo the current test number echo "Test{$test} = "; $values = []; foreach ($items as $item) { // Get the correct value. if (array_key_exists('value', $item[0])) { $values[] = $item[0]['value']; continue; } if (array_key_exists('target_id', $item[0])) { $values[] = $item[0]['target_id']; continue; } } echo '"' . implode('", "', $values) . '"' . "\n"; $test++; }
You have javascript disabled. You will not be able to edit any code.
This script was stopped while abusing our resources