Values inside foreach [on hold]

My code is as follows:

$cmb_audio = get_post_meta( get_the_ID(), 'cmb2_audio_upload', true ); $count_tracks = count( $cmb_audio );  foreach ( (array) $cmb_audio as $id => $url ) {      if ( $count_tracks >= 2 ) {         $playlist_ids = implode(',', $id );                                      } else {         $audio_url = wp_get_attachment_url( $id );       }  }     if ( $count_tracks >= 2 ) {     echo do_shortcode('[playlist ids="'.$playlist_ids.'"]'); } else {     echo '<div class="audio-player" itemprop="audio">' . wp_audio_shortcode( $attr ) . ' </div>'; } 

When I do var_dump($playlist_ids); I get the two audio uploads.

When I do var_dump($playlist_ids); inside or outside the foreach, I get NULL.

When I do var_dump($id); inside the foreach I get int(9034) int(9070)

When I do var_dump($id); outside the foreach I only get int(9070) (only the last one)

How to get the id numbers of the uploaded files inside $playlist_ids? Any help is much appreciated.

Replay

Category: foreach Time: 2016-07-28 Views: 1
Tags: foreach audio

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.356 (s). 12 q(s)