Re: [PHP] Breaking up data efficiently

2005-06-28 Thread Jason Barnett
Kevin L'Huillier wrote: ... Create the function split_location to return the associative array or, if it is invalid, throws an exception. If PHP4, replace the exception with similar error handling. If efficiency is really the goal, then the OP probably shouldn't go the route of Exceptions.

Re: [PHP] Breaking up data efficiently

2005-06-28 Thread Kevin L'Huillier
In my opinion you should save exceptions for, well, EXCEPTIONal problems. Either that or you use exceptions for a large system that discriminates against specific types of errors and handles each error type in a totally different way. Can we say bloat? Depending on the system, malformatted

Re: [PHP] Breaking up data efficiently

2005-06-28 Thread Edward Vermillion
On Jun 28, 2005, at 9:40 AM, Kevin L'Huillier wrote: In my opinion you should save exceptions for, well, EXCEPTIONal problems. Either that or you use exceptions for a large system that discriminates against specific types of errors and handles each error type in a totally different way. Can

[PHP] Breaking up data efficiently

2005-06-27 Thread Wee Keat
Hi All, I'm working on an aircraft booking system and it has multiple origin/destination data, concatenated into a single line: /* BEGIN DATA */ Melbourne, AU, 21-07-2005 14:00:00|Perth, AU, 21-07-2005 18:00:00|Perth, AU, 25-07-2005 14:00:00|Melbourne, AU, 25-07-2005 18:00:00 /*

Re: [PHP] Breaking up data efficiently

2005-06-27 Thread Philip Hallstrom
On Tue, 28 Jun 2005, Wee Keat wrote: Hi All, I'm working on an aircraft booking system and it has multiple origin/destination data, concatenated into a single line: /* BEGIN DATA */ Melbourne, AU, 21-07-2005 14:00:00|Perth, AU, 21-07-2005 18:00:00|Perth, AU, 25-07-2005

Re: [PHP] Breaking up data efficiently

2005-06-27 Thread Tom Rogers
Hi, Tuesday, June 28, 2005, 9:34:28 AM, you wrote: WK Hi All, WK I'm working on an aircraft booking system and it has multiple WK origin/destination data, concatenated into a single line: WK /* BEGIN DATA */ WK Melbourne, AU, 21-07-2005 14:00:00|Perth, AU, 21-07-2005 18:00:00|Perth,

Re[2]: [PHP] Breaking up data efficiently

2005-06-27 Thread Tom Rogers
Hi, Tuesday, June 28, 2005, 10:26:12 AM, you wrote: TR This ay work: TR ? TR $str = 'Melbourne, AU, 21-07-2005 14:00:00|Perth, AU, TR 21-07-2005 18:00:00|Perth, AU, 25-07-2005 14:00:00|Melbourne, AU, TR 25-07-2005 18:00:00'; TR

Re: [PHP] Breaking up data efficiently -- closed

2005-06-27 Thread Wee Keat
Hi all, Thanks for all the input. Really an eye opener on all the various ways that could do the same thing! :) Really appreciate it. Off to work with new ideas! Tom Rogers wrote: function build($data){ global $path; $i = count($path); $path[$i]['location'] = $data[1];

Re: [PHP] Breaking up data efficiently

2005-06-27 Thread Kevin L'Huillier
I agree, your implementation is efficient. It does depend on the data being entirely proper, however. If you can not be entirely sure (and you should rarely be), i might add a suggestion that increases code length, but decreases the chance of problems: You might consider creating a function to