Difference between require, include, require_once and include_once ?

It is possible to insert the content of one PHP file into another PHP file (before the server executes it), with the include or require statement.

The include and require statements are identical, except upon failure:

  • require will produce a fatal error (E_COMPILE_ERROR) and stop the script
  • include will only produce a warning

    Read More

Clear the browser cache of CSS or JavaScript Using PHP

Other than caching every hour, or every week, you may cache according to file data.

or use file modification time:

or use file modification every hour:

or Using Javascript


Read More

PHP: fopen error handling

You should first test the existence of a file by file_exists().

or simple solution without exceptions:


Read More

PHP function to make slug (URL string)

Note: from WordPress

Use it like this:



Read More

Current Site URL – Codeigniter

To get host url of current server simply replace




Read More

Random String PHP

Output the random string with the call below:


Read More