Archive

Posts Tagged ‘PHP Function’

PHP – HOW TO: check if a URL exists or not ?

August 26th, 2008 No comments
PHP – HOW TO: check if a URL exists or not ? 1'st php function (the simplest way): function test_url_file($url) { $res = (($ftest = @fopen($url, 'r')) === false) ? false : @fclose($ftest); return ($res == TRUE) ? 1:0 ; } 2'nd php function, using fsockopen (not so simple) ! function test_url_file2($url) { $addr=parse_url($url); $host=$addr['host']; $path = $addr['path']; $headtxt = ''; if($sock=fsockopen($host,80, $errno, ...

PHP: array_unique without gap !

May 19th, 2008 No comments
PHP: array_unique without gap ! If you use array_unique function for getting unique values in a simple array and if you need the index to be linear use this : $unique = array_keys(array_flip($array)); This metod is about twice as fast or fast as array_unique ! Note that ...

easter_days() PHP Function

April 1st, 2008 No comments
easter_days() PHP Function easter_days — Get number of days after March 21 on which Easter falls for a given year Function returns the number of days after March 21 on which Easter falls for a given year. If no year is specified, the current ...
GoCache - ByREV-Cache v1.0 - live served in : 0.382048 sec (gzip)