|
Posted by Kevin L'Huillier on 06/28/05 07:53
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 validate the location as
well as list() = explode() it.
$locations = explode('|', $booking->booking_flight_details);
foreach ($locations as $location)
$list[] = split_location($location);
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.
Navigation:
[Reply to this message]
|