Get Latitude & Longitude from address

function getLatLong($address){
    $prep_addr = str_replace(' ','+',$address);

    $geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$prep_addr.'&sensor=false');

    $output= json_decode($geocode);

    $lat = $output->results[0]->geometry->location->lat;
    $long = $output->results[0]->geometry->location->lng;

    return array("latitude" => $lat, "longitude" => $long);
}

Read .docx file as string

I found it after googling for a day, finally a function that reads the .docx file and return you a string. Hats off to the original author of this function.

function readDocx($file_name){
    $striped_content = '';
    $content = '';
    if(!$file_name || !file_exists($file_name))
        return false;

    $zip = zip_open($file_name);
    if (!$zip || is_numeric($zip))
        return false;

    while ($zip_entry = zip_read($zip)) {
        if (zip_entry_open($zip, $zip_entry) == FALSE)
            continue;
        if (zip_entry_name($zip_entry) != "word/document.xml")
            continue;
        $content .= zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
        zip_entry_close($zip_entry);
    }// end while
    zip_close($zip);

    $content = str_replace('</w:r></w:p></w:tc><w:tc>', " ", $content);
    $content = str_replace('</w:r></w:p>', "\r\n", $content);
    $striped_content = strip_tags($content);
    return $striped_content;
}

Convert object to multi dimensional array

   /**
    *
    * Convert an object to an array
    *
    * @param    object  $object The object to convert
    * @reeturn      array
    *
    */
    
function objectToArray$object )
    {
        if( !
is_object$object ) && !is_array$object ) )
        {
            return 
$object;
        }
        if( 
is_object$object ) )
        {
            
$object get_object_vars$object );
        }
        return 
array_map'objectToArray'$object );
    }

    
/*** convert the array to object ***/
    
$array objectToArray$obj );

    
/*** show the array ***/
    
print_r$array );


 Taken from phpro.org