Decomprimere file .gz

function gzfile_get_contents($filename, $use_include_path = 0)
{
	//File does not exist
	if(!@file_exists($filename)) {
		return false;
	}
	
	//Read and imploding the array to produce a one line string
	$data = gzfile($filename, $use_include_path);
	$data = implode($data);
	return $data;
}
//scriviamo il risultato in un file
file_put_contents('punto.txt', gzfile_get_contents('punto.txt.gz'));

System.Collections.Hashtable

Rappresenta un insieme di coppie chiave/valore organizzate in base al codice hash della chiave.

using System;
using System.Collections;

class Example
{
	public static void Main()
	{
		Hashtable htTest = new Hashtable();

		htTest.Add("txt", "notepad.exe");
		htTest.Add("bmp", "paint.exe");
		htTest.Add("dib", "paint.exe");
		htTest.Add("rtf", "wordpad.exe");

		try
		{
			htTest.Add("txt", "winword.exe");
		}
		catch
		{
			Console.WriteLine("Un elemento con 'Key' = 'txt' esiste gia.");
		}

		Console.WriteLine("Per la 'key' = 'rtf', 'Value' = {0}.", htTest["rtf"]);

		htTest["rtf"] = "winword.exe";
		Console.WriteLine("Per la 'key' = 'rtf', 'Value' = {0}.", htTest["rtf"]);

		htTest["doc"] = "winword.exe";

		if (!htTest.ContainsKey("ht"))
		{
			htTest.Add("ht", "hypertrm.exe");
			Console.WriteLine("Valore aggiunto con 'key' = 'ht', 'Value' = {0}", htTest["ht"]);
		}

		Console.WriteLine();
		foreach( DictionaryEntry de in htTest )
		{
			Console.WriteLine("'Key' = {0}, 'Value' = {1}", de.Key, de.Value);
		}

		ICollection valueColl = htTest.Values;

		Console.WriteLine();
		foreach( string s in valueColl )
		{
			Console.WriteLine("'Value' = {0}", s);
		}

		ICollection keyColl = htTest.Keys;

		Console.WriteLine();
		foreach( string s in keyColl )
		{
			Console.WriteLine("'Key' = {0}", s);
		}

		Console.WriteLine("nRimuovo elemento con chiave = 'doc'");
		htTest.Remove("doc");

		if (!htTest.ContainsKey("doc"))
		{
			Console.WriteLine("L'elemento con chiave = 'doc' non esiste.");
		}
	}
}

Formattare i numeri con printf()

$number = 15;
printf("Decimal: %d", $number);	//Decimal: 15
printf("Binary: %b", $number);	//Binary: 1111
printf("Double: %f", $number);	//Double: 15.000000
printf("Octal: %o", $number);	//Octal: 17
printf("String: %s", $number);	//String: 15
printf("Hex (lower): %x", $number);	//Hex (lower): f
printf("Hex (upper): %X", $number);	//Hex (upper): F