PHP Code Snippets

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

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