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

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

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which attribute is used in <a> tag for the address of the link?
src href rel
<a href="http://coursesweb.net/" title="CoursesWeb.net">CoursesWeb.net</a>
Which CSS property sets the type of the text font?
font-family text-decoration font-size
h2 {
  font-family:"Calibri",sans-serif;
}
What instruction selects all the <div> tags with class="cls"?
querySelector("div.cls") getElementsByTagName("div") querySelectorAll("div.cls")
var elm_list = document.querySelectorAll("div.cls");
var nr_elms = elm_list.length;       // number of selected items
alert(nr_elms);
Indicate the function that can be used to get the sum of values in an array.
array_sum() array_diff() array_shift()
$arr = array(1, 2, 3, 4);
$arr_sum = array_sum($arr);
echo $arr_sum;       // 10
PHP Code Snippets

Last accessed pages

  1. Arrays in ActionScript 3 (119)
  2. this and target in JavaScript Events (98)
  3. Add, Change, and Remove Attributes with jQuery (3615)
  4. SSEP - Site Search Engine PHP-Ajax (618)
  5. PHP Chat Script (4355)

Top accessed pages

  1. PHP-MySQL free course, online tutorials PHP MySQL code (5207)
  2. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (4975)
  3. Get Attribute (ID, Class, Name, Title, Src) with jQuery (4777)
  4. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (4622)
  5. PHP Chat Script (4355)