denoteone Posted March 17, 2010 Share Posted March 17, 2010 I think my issue is referencing my array value with a php variable function getPrice($pulse_id) { $sub_array = $pulse_data['$pulse_id']; $info = explode(" ", $sub_array); $pulse_price = $info[5]; return $pulse_price; } echo getPrice('231'); Link to comment https://forums.phpfreaks.com/topic/195608-using-variable-to-reference-array-value/ Share on other sites More sharing options...
XGCommander Posted March 17, 2010 Share Posted March 17, 2010 $sub_array = $pulse_data['$pulse_id']; change it to $sub_array = $pulse_data[$pulse_id]; only use single quotes when you are inserting a value directly. Link to comment https://forums.phpfreaks.com/topic/195608-using-variable-to-reference-array-value/#findComment-1027797 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.