note 34094 deleted from ref.array by sniper

From: Date: Sat, 18 Oct 2003 18:00:25 +0000
Subject: note 34094 deleted from ref.array by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58818@lists.php.net to get a copy of this message
Note Submitter: simbiosys ---- Here's a function that might be useful for calendaring events. I pulled the rows from MySql and wanted to add the records to an array. /* sample of array: August 20, 2003 has 2 events $array_events['2003-08-20'][0][0] = "EventA Title" $array_events['2003-08-20'][0][1] = "EventA Description" $array_events['2003-08-20'][1][0] = "EventB Title" $array_events['2003-08-20'][1][1] = "EventB Description" */ function addArray(&$array, $key, $val) #$val is an array { if (array_key_exists($key, $array)) { $array[$key] = array_merge ($array[$key], array($val)); } else { # make a temp array who has a key to an array whose first index is the $val array. $tempArray = array($key => array($val)); $array = array_merge ($array, $tempArray); } }

« previous php.notes (#58818) next »