3v4l.org

run code in 300+ PHP versions simultaneously
<?php $body = array ( 'tags' => array ( 0 => array ( 'tag_id' => 70, 'tag_slug' => 'step-by-step-macintosh-training', 'tag_name' => 'step-by-step-macintosh-training', 'tag_description' => '', 'contact_count' => 4, 'show_as_preference' => 0 ), ), 'status' => 'success' ); $tags = array(); foreach ($body['tags'] as $tag) { $tags[] = array('tag_id'=>$tag['tag_id'], 'tag_name'=>$tag['tag_name']); } print_r($tags);
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Array ( [0] => Array ( [tag_id] => 70 [tag_name] => step-by-step-macintosh-training ) )

preferences:
97.46 ms | 1492 KiB | 4 Q