| 
	
 | 
 Posted by Wee Keat on 06/28/05 04:37 
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]; 
>   $path[$i]['country'] = $data[2]; 
>   $path[$i]['datetime'] = $data[3]; 
> } 
> $path = array(); 
> $str = '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'; 
> preg_replace_callback('/(\w+),\s*(\w+),\s([0-9-]+\s[0-9:]+)(?=\|)/s','build',$str); 
> print_r($path); 
 
 
Jasper Bryant-Greene wrote: 
> $itinerary = explode('|', $booking->booking_flight_details); 
>  
> foreach($itinerary as $item) { 
> 	$item = explode(',', $item); 
> 	$path[] = array( 
> 		'location'	=> $item[0], 
> 		'country'	=> $item[1], 
> 		'datetime'	=> $item[2] 
> 	); 
> } 
 
 
Philip Hallstrom wrote: 
> $bits = split("[|,]", $booking->booking_flight_details); 
> $size = count($itenary); 
> for ( $i = 0; $i < $size; $i += 3 ) { 
>     $path[$i]['location'] = $bits[$i]; 
>     $path[$i]['country'] = $bits[$i + 1]; 
>     $path[$i]['datetime']  = $bits[$i + 2]; 
> } 
>  
 
 
 
 
--  
Wee Keat Chin 
 
Protocol Networks 
p: 1300 131 932 
e: weekeat@pn.com.au 
h: www.pn.com.au
 
  
Navigation:
[Reply to this message] 
 |