Jump to content

[SOLVED] Using a Variable in an Array


da-vid

Recommended Posts

Alright, so I have this code:

 

$weekvotes = array_merge($weekvotes, array($song['id'] => 1));

 

And $song['id'] = 14. However, the array comes out as [0] => 1 instead of [14] => 1.

 

... However, when I do this:

 

$weekvotes = array_merge($weekvotes, array($song['id'] .' ' => 1));

 

It shows up properly as [14 ] => 1. However, I do not want the space, but when I remove it, it changes back to 0.

Link to comment
https://forums.phpfreaks.com/topic/169203-solved-using-a-variable-in-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.