3v4l.org

run code in 300+ PHP versions simultaneously
<?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++; }

Abusive script

This script was stopped while abusing our resources

Output for git.master_jit, git.master, rfc.property-hooks
Test1 = "1", "2", "3", "4" Test2 = "11", "22", "33", "44"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
77.74 ms | 405 KiB | 5 Q