Home >> Snippet List

PHP Code Snippets

<<first    <prev    1  2  3  4  5  (6) 7  8  9       next>     last>>
  • Is Number Even? - If the variable contains an odd number, don't execute the code If the variable cont...
  • Language Specific Response - Ever wanted to give response to the users in the language they prefer? Mos...
  • List files in directory - Prints out all of the files inside a given directory...
  • Live validation of email address - This is a very simple function that can be used to validate email ad...
  • Make grayscaled image - Makes a grayscaled image on the fly...
  • Measure script run time - Measure the run time of a function or script process...
  • Mini-mail / Private Messaging system - Internal Mail System or private messaging system Easy to embed...
  • Mini private messaging system - Email a user without exposing email address Keeping emails hidden is...
  • MKDIR with error checking - A mkdir function with a simple exception handler...
  • Month, Day, Year dropdown boxes - Creates three SELECT form fields Month Day and Year...
  • More File Type Detection in PHP - Detect files type in PHP Not absolutely foolproof, but very good...
  • Neatly trim a string to a set number of words - Trim a string along a word boundary that you specify, a...
  • Nice 'Read More...' links - This will display the first 200 characters and then search for the next per...
  • Nicely Format File Size - Nicely format the size of a given file properly...
  • Online PHP Tester - Online PHP Tester- this lets you test arbitrary PHP code from a browser...
  • Optimize All Database Tables (mySQL) - Short but useful script that optimizes all tables in a mySQL dat...
  • Oracle with PHP - This example demonstrates how data can be SELECTed and manipulated via INSERT, UPDATE...
  • Ordinalize (Suffix) Numbers - Add suffix to number (1st, 2nd, 3rd, 4th)...
  • Output as Word Doc format - Pull data from a DB and output it in MS Word (DOC) format...
  • Output mySQL data in columns - A simple PHP script that outputs data into formatted columns This scr...
  • Page creation time #2 - Just paste it into the header of the PHP file you wish to show it on, and it w...
  • Page creation time - Tells you how many seconds it took to load the page...
  • Pagination Example #1 - Simple pagination example Easily modified for more functionality...
  • Pagination Example #2 - A well thought out pagination function Easy to modify and/or expand...
  • Parse RSS into array - Parses RSS into an array Quick, simple, and nasty but it does the job...
  • Pass vars to/from Javascript - Examples of how to pass vars from PHP to and from Javascript...
  • Perfect Highlighting Function - This one works very well :)...
  • Permutation Generator - This Permutation Generator will produce all of the possible combinations of the...
  • PHP to JavaScript Array - Given a PHP array (even a deep nested array), this function returns a string ...
  • Pick Randomly from Array - Randomly pick out one of the array elements and turn it into a string variab...
  • <<first    <prev    1  2  3  4  5  (6) 7  8  9       next>     last>>