Some PHP functions and code snippets useful for PHP Programmers and scripts.
New PHP Code Snippets might be added soon.

  1. Mysql SELECT JOIN tables on two different Databases
  2. Output or Force Download MP3 with PHP
  3. Counter Page Visits
  4. Zodiac Signs PHP code
  5. Calculate the Age in PHP
  6. Get the difference between two Dates - Time and Date
  7. Read ZIP archive data with PHP
  8. Extract / Unzip ZIP archive files with PHP
  9. Create ZIP file archive with PHP
  10. Get Lower, Higher, and Closest Number
  11. Get Closest Number
  12. Get all the unique numbers from two-dimensional array
  13. PHP Image with text on New Lines
  14. Get visitor IP in PHP
  15. Save image on server from external URL
  16. Split an alphanumeric string into Array in PHP
  17. XML sitemap with data from MySQL
  18. Recursive function to create Multi-Level Menu in PHP
  19. Chaining Static and Public Methods in PHP
  20. Dynamically PHP Maps with Rectangle, Parallelogram, and Rhomb Shapes
  21. Merge Multiple Files, Line by Line
  22. Sort an entire multi-dimensional Array
  23. Image in PHP with background in two colors
  24. Create Array of Unique Random Numbers or Letters
  25. Get the Timestamp of First and Last day of Month
  26. Convert XML to JSON in PHP
  27. Keep the first Nr IMG tags, Strip all the others
  28. innerHTML in PHP
  29. Force Download files with PHP
  30. Delete multiple consecutive characters and Split long words
  31. Interpret / Parse / Replace variable in string with value
  32. Get Time Elapsed

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which type of <input> creates input fields that should contain a numeric value?
type="text" type="number" type="date"
<input type="number" name="points" min="5" max="80" />
Which CSS property allows to change the transparency of an element?
font-style opacity color
#id {
  filter:alpha(opacity=40);    /* for IE */
  opacity:0.4;
}
Click on the function that formats a number to specified number of characters.
toPrecision() exp() toFixed()
var num = 12.34567;
alert( num.toPrecision(3) );       // 12.3
Which function randomizes the order of the elements into an array?
natsort() shuffle() sort()
$lang = array(10=>"PHP", 20=>"JavaScript", "site"=>"coursesweb.net");
shuffle($lang);
var_export($lang);     // array (0=>"coursesweb.net", 1=>"PHP", 2=>"JavaScript")
PHP Code Snippets

Last accessed pages

  1. Create simple Website with PHP (10317)
  2. PHP getElementById and getElementsByTagName (10264)
  3. Download PHP MySQL resources (6324)
  4. PHP PDO - Select query, fetch (11738)
  5. Ajax-PHP Chat Script (23961)

Top accessed pages

  1. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (41477)
  2. Read Excel file data in PHP - PhpExcelReader (31778)
  3. PHP-MySQL free course, online tutorials PHP MySQL code (31726)
  4. Get Attribute (ID, Class, Name, Title, Src) with jQuery (29012)
  5. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (25987)