savagenoob Posted January 31, 2011 Share Posted January 31, 2011 OK, I have 2 arrays that I want to combine, not with array_combine, but the data from $array2[0] gets added to the data in $array1[0]. How can this be done... Quote Link to comment https://forums.phpfreaks.com/topic/226205-array-help/ Share on other sites More sharing options...
denno020 Posted January 31, 2011 Share Posted January 31, 2011 for(int i = 0 ; i < array length ; i++){ arraytotal[i] = array1[i] + array2[i]; } change 'array length' to whatever the php function is that will get the length of an array. Denno Quote Link to comment https://forums.phpfreaks.com/topic/226205-array-help/#findComment-1167732 Share on other sites More sharing options...
doddsey_65 Posted January 31, 2011 Share Posted January 31, 2011 $array1[0] = $array1[0].$array2[0]; Quote Link to comment https://forums.phpfreaks.com/topic/226205-array-help/#findComment-1167736 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.