linux1880 Posted August 29, 2010 Share Posted August 29, 2010 Hi friends how does this types of array operate ? pls help, I am repeatedly facing this code but my brain can't hold, i am familiar with multi dimensional array but what are these ? $data[$row['id']] $options['data']=$row[0]; Link to comment https://forums.phpfreaks.com/topic/212026-how-does-this-type-of-array-operate-in-php/ Share on other sites More sharing options...
wildteen88 Posted August 29, 2010 Share Posted August 29, 2010 Well the first is grabbing an item from the $data array, based on the value of $row['id']. So if $row['id'] is set to 5 then the following echo $data[$row['id']]; Is the same as echo $data[5]; This $options['data']=$row[0]; Is just variable assignment. Except they are arrays. Link to comment https://forums.phpfreaks.com/topic/212026-how-does-this-type-of-array-operate-in-php/#findComment-1104959 Share on other sites More sharing options...
linux1880 Posted August 29, 2010 Author Share Posted August 29, 2010 what does empty array such as $row[] means ? Link to comment https://forums.phpfreaks.com/topic/212026-how-does-this-type-of-array-operate-in-php/#findComment-1104979 Share on other sites More sharing options...
Alex Posted August 29, 2010 Share Posted August 29, 2010 $row[] = "value"; Would add an element to the end of the $row array with the value of "value". Link to comment https://forums.phpfreaks.com/topic/212026-how-does-this-type-of-array-operate-in-php/#findComment-1104980 Share on other sites More sharing options...
linux1880 Posted August 29, 2010 Author Share Posted August 29, 2010 Thnaks alex, got it, but I am not very clear on original question. Link to comment https://forums.phpfreaks.com/topic/212026-how-does-this-type-of-array-operate-in-php/#findComment-1104986 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.