Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting rid of comma on last element of array
    primarykey
    data
    text
    <p>I have an array that loops through music tracks but I need to remove the comma from the last element of the array, can someone help?</p> <pre><code>&lt;?php foreach ($bucket_contents as $file){ $fname = $file['name']; $furl = "http://".$isdHtml5Bucket.".s3.amazonaws.com/".urlencode($fname); if(preg_match("/\.mp3$/i", $furl)) { ?&gt; { name:"&lt;?php echo basename($fname); ?&gt;", mp3:"&lt;?php echo $furl; ?&gt;" }, &lt;?php }else{ ?&gt; { name:"&lt;?php echo basename($fname); ?&gt;", m4a:"&lt;?php echo $furl; ?&gt;" },&lt;?php } } ?&gt; </code></pre> <p>And here is the output of the array.</p> <pre><code> { name:"bassline", m4a:"http://suyssamuelarawaeast.s3.amazonaws.com/warehouse%2Fbassline%2F" }, { name:"Project Bassline - Drop The Pressure (Jack Beats Rinsed Out Remix).mp3", mp3:"http://suyssamuelarawaeast.s3.amazonaws.com/warehouse%2Fbassline%2FProject+Bassline+-+Drop+The+Pressure+%28Jack+Beats+Rinsed+Out+Remix%29.mp3" }, { name:"deadmau5 vs jelo the reward is cheese.mp3", mp3:"http://suyssamuelarawaeast.s3.amazonaws.com/warehouse%2Fdeadmau5+vs+jelo+++the+reward+is+cheese.mp3" }, { name:"vocal", m4a:"http://suyssamuelarawaeast.s3.amazonaws.com/warehouse%2Fvocal%2F" }, { name:"Thin Ice", free:true, mp3:"http://www.jplayer.org/audio/mp3/Miaow-10-Thin-ice.mp3", oga:"http://www.jplayer.org/audio/ogg/Miaow-10-Thin-ice.ogg" }, </code></pre> <p>If you scroll to the last element of the array you can see a comma is output. I really need to remove this comma from the last element of the array.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload