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

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

Daily Test with Code Example

Click on the tag that creates a cell in table
<tr> <span> <td>
Indicate the CSS property used to specify a background image for an element
background-color background-image color
h3 {
  background-image: url("image.jpg");
What instruction can be used to parse all the array items?
for() array() object()
var arr = [1, "ab", ""];
for(var i=0; i< arr.length; i++) { alert(arr[i]); };
Indicate the PHP instruction used to traverse an associative array.
for() foreach() if()
$arr = array("k1"=>"v1", "k2"=>"v2", "k3"=>"v3");
foreach($arr AS $k => $v) { echo "<br/>". $k ." - ". $v; }
PHP Code Snippets

Last accessed pages

  1. Get Attribute (ID, Class, Name, Title, Src) with jQuery (2966)
  2. Get the value of multiple selected checkboxes with same name (514)
  3. Add and Remove HTML elements and Content with jQuery (1774)
  4. Writing PHP scripts (645)
  5. AJAX and XML (90)

Top accessed pages

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