Have a Snippet?

Keep, track and share your code snippets with your friends

Tag "PHP" (34)


PHP: Force the browser to download the file Share on Vkontakte

Force the browser to download the file instead of opening it ... Reveal Code



PHP: Determination of the country by IP Share on Vkontakte

Determination of the country by IP using geoplugin.net OR ipinfodb.com. Will return the country code in "Alpha-2 ISO 3166-1" format (a two-char code) ... Reveal Code


PHP: Determination of the browser and its version Share on Vkontakte

Determination of the browser and its version by user-agent string. ... Reveal Code


PHP: Расстояние между двумя точками Share on Vkontakte

Вычисление расстояния между двумя точками, в зависимости от их координат. ... Reveal Code


PHP: Convert the timestamp to human-readable format Share on Vkontakte

Convert the timestamp to human-readable format like XX minutes ago or XX days ago. Was found here: http://stackoverflow.com/questions/2915864/php-how-to-find-the-time-elapsed-since-a-date-time ... Reveal Code


PHP: Whois query Share on Vkontakte

Whois query by Jonas John ... Reveal Code


PHP: Session lifetime Share on Vkontakte

Session lifetime. An important point: set a directory to store sessions. ... Reveal Code


PHP: Convert the date interval to human-readable format Share on Vkontakte

Convert the date/time interval in human-readable format ... Reveal Code


PHP: Auto-crop the image Share on Vkontakte

This class can be used to crop images by removing edges with same color. It can load a GIF, JPEG or PNG image and scans it to detect edges color, so it crops the image to remove the edge areas that have the same color around it. The cropped image is outputted in the same format as the original image. ... Reveal Code


PHP: Limit Words in a String Share on Vkontakte

If you wanted to do this effect quickly, you could just use the function substr(). However, the substr() function only limits the number of characters being displayed. The returned result would be an excerpt of text that may or may not have the ending word cut-off. ... Reveal Code


PHP: Symfony1.4: use Tidy to create announces from blob field Share on Vkontakte

usage:rn$announce = ccTidy::clearAndCrop($content, $extractLen = 100, $raw = true); ... Reveal Code


PHP: Find all the links on a page Share on Vkontakte

Find all the links on a page (except of dummy links like "#") ... Reveal Code


PHP: Check availability of a website Share on Vkontakte

Check availability of a website ... Reveal Code


PHP: Parse XML Share on Vkontakte

Parse XML via SimpleXML ... Reveal Code


PHP: Send an HTML formatted email Share on Vkontakte

Send an HTML formatted email. Supports all HTML formatting ... Reveal Code


PHP: Execution time of the script Share on Vkontakte

Execution time of the script. Shows the text like this: "The script has been executed in 0.0090 sec." ... Reveal Code


PHP: Allow only numbers and letters Share on Vkontakte

Allow only numbers and letters using preg_match ... Reveal Code


PHP: Make a clickable text Share on Vkontakte

Make a clickable text: replace all the URLs with tag ... Reveal Code


PHP: Determination of the OS Share on Vkontakte

Determination of the OS by user-agent string ... Reveal Code