Michan Posted December 11, 2007 Share Posted December 11, 2007 Hi everyone, For some reason I am having problems inserting a new key/value into an existing array using array_push(). $i1 = array('number1' => 'Hello!'); array_push($i1, 'number2' => 'Hmm.'); Parse error: syntax error, unexpected T_DOUBLE_ARROW on line 5 What's going on here? Many thanks in advance. - Mi Link to comment https://forums.phpfreaks.com/topic/81156-solved-problems-with-array_push/ Share on other sites More sharing options...
tapos Posted December 11, 2007 Share Posted December 11, 2007 Try this instead of array_push() function $i1 = array('number1' => 'Hello!'); $i1['number2'] = 'Hmm.'; Link to comment https://forums.phpfreaks.com/topic/81156-solved-problems-with-array_push/#findComment-411798 Share on other sites More sharing options...
Michan Posted December 11, 2007 Author Share Posted December 11, 2007 Great idea; can't believe this didn't cross my mind! Thanks Link to comment https://forums.phpfreaks.com/topic/81156-solved-problems-with-array_push/#findComment-411807 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.