Return to Snippet

Revision: 37896
at December 19, 2010 15:15 by iloveitaly


Initial Code
function getAddress($dbObject) {
	$keys = array('address1', 'city', 'providence', 'postal_code');
	$values = array();
	
	foreach($keys as $key)
		if(!empty($dbObject->$key))
			$values[] = $dbObject->$key;
			
	return implode(' ', $values);
}

Initial URL


Initial Description
Useful when used with the google map directions function http://snipplr.com/view/15530/php-create-google-map-directions-link/

Initial Title
Generate Address String from Array / Object

Initial Tags
object, array

Initial Language
PHP