help with calendar library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: help with calendar library (/showthread.php?tid=32900) |
help with calendar library - El Forum - 08-09-2010 [eluser]jochemvn[/eluser] My question is more about arrays then about the calendar library. I have 1 calendar, but I want to add data to my calendar from multiple models. Each model returns an array. How dow I merge these arrays? Code: Array 1: How do I merge these 2 array's so they look like this: Code: Array 3: Using array_merge resets the numbers, which correspond with the day's of a month, so that's no good. I could probably use a foreach to add the elements of the second array to the first, but I'm wondering if there's a single command to get this working. Any suggestions? help with calendar library - El Forum - 08-09-2010 [eluser]Georgi Budinov[/eluser] Try this: Code: $result = $array1 + $array2; help with calendar library - El Forum - 08-09-2010 [eluser]jochemvn[/eluser] holy s... too easy that one thanx a lot... :red: help with calendar library - El Forum - 08-10-2010 [eluser]jochemvn[/eluser] hmm that didn't quite work out, since array 3 now look like this: Code: Array 3: instead of this: Code: Array 3: Of course it's not possible to get duplicate entries in an array, however is there a php function that detects duplicate entries and creates an array in an array like this: Code: Array 3: Any suggestions? help with calendar library - El Forum - 08-10-2010 [eluser]Georgi Budinov[/eluser] Yes, the keys in the array get overridden with the values from the second array. There is no easy shortcut for doing exactly what you want as far as I know. You better create your own function iterating through the arrays, merging them as you want and use it. help with calendar library - El Forum - 08-10-2010 [eluser]buckit[/eluser] is this what you are looking for? Code: <?php Code: Array ( [15] => Appointment with Mom |