PHP Random function of the day

clearstatcache() Function
The clearstatcache() function clears the file status cache.
void clearstatcache ([ bool $clear_realpath_cache = false [, string $filename ]] )
your are using filetype(),is_file() or some functions affected function listing below it.PHP caches the information those functions return in order to give better performance.
Affected some functions list: filesize(), filetype(), is_writable(), is_readable(), is_executable(), is_file(), filectime(), fileatime(), is_dir(), is_link(), filemtime(), fileinode(), filegroup(), fileowner(), stat(), lstat(), file_exists(), and fileperms().
Example

//check the filesize
echo "File Size: "; echo filesize("example.txt");
$filename = fopen("example.txt", "a+");
// truncate file
ftruncate($filename,100);
fclose($filename);
//Clear cache and check the filesize again
clearstatcache();
echo "File Size: "; echo filesize("example.txt");

Output

File Size: 500
File Size: 75

Linux Random command of the day

Tar Command

Tar command is an archiving utility of single file or directory, it was designed to (backup, extract and listing) an archive files. You can create an archive formats for gzip and bzip compression files.

Let us check with the option used in this example.
  • c - create a new archive
  • x - extract or restore an archive file
  • t - listing an archive file
  • v - Verbosely list files which are processed
  • f - following is the archive file name
  • z - filter the archive through gzip
  • j - filter the archive through bzip2
Example

  • Create an Archive file
      tar cvf archive_filename.tar directory_name/
  • Create an gzipped Archive file
      tar cvzf archive_filename.tar.gz directory_name/
  • Create an bzipped Archive file
      tar cvfj archive_name.tar.bz2 directory_name/
  • Extract or restore a tar file using tar commands below there.
      tar xvf archive_filename.tar /path
      tar xvfz archive_filename.tar.gz /path
      tar xvfj archive_filename.tar.bz2 /path
  • Listing an Archive file
      tar tvf archive_filename.tar
      tar tvfz archive_filename.tar.gz
      tar tvfj archive_filename.tar.bz2

Download Free PHP Scripts for your website

Pagination Script

Pagination is an effective and flexible to easy integrate in a PHP page. Pagination is the process of dividing multi records and displaying it on separate pages. Single page using multi listing pagination supported and make it very easy integrate to the page in our pagination script class.


Pagination of purpose avoids a page length, reduce the loading time in a page, effective navigation and user friendly. You can very easy customizing a style into different models for example active page number, hover page number and (active or deactivate) previous & next button.

(8 votes, average: 3.5 out of 5)

Captcha Script

Captcha image is generates powerful random alphanumeric security codes. This codes used in a web site form protecting from hackers, spam bots and abuse. Web form all information data inside in a captcha image and stop automatically submissions in your web form protect from junk information data submitted by spam bots.


Captcha code needs support for GD library enable with in a PHP config file and font also with in a site.


You can easy customizing a captcha code for example (specify size of the image width and height, color of text, background color, number of letters).

(7 votes, average: 3.3 out of 5)

jQuery Validation (display message like a tooltip)

jQuery validation is powerful client side form validation, good effect, user friendly, web response very quick get the result and these are all feel for the users. Usage for this script created a div positions it in the top right corner of the input field and display the validation message like a tool tip.


Display the error message in a rounded corner and shadow are done with CSS and disgrace well in non acquiescent browsers. There is no need of images and validation rules are created within the class of every input field.

(9 votes, average: 3.4 out of 5)