{ Snipperize } /PHP

PHP snippets

Here are the latest PHP snippets. Please choose your favorite one or add a new one.

Date and Time Difference Calculate in PHP

Calculate date time difference.

PHP / date, time, calculate / by ThePeppersStudio (4 days, 9.71 hours ago)

Kohana System Configuration Hook

Instead of having multiple configurations for multiple domains, and the numerous if/then/else statements not to mention the various locations for storing the configuration....instead, enable hooks in your application config and then add this snippet of code into your application hooks directory.

PHP / php, kohana, system, configuration, hook / by ThePeppersStudio (8 days, 3.40 hours ago)

How to read ID3 tag of mp3 files with PHP

Inside mp3 files there are often some usefull informations stored. Those data are called “id3 tags” and deal with Author name, Title and Album name. There are also some other informations sometimes: such as the length of the track, or the track number of the album, and more, this code will help read those files!

PHP / mp3, id3, meta / by ThePeppersStudio (27 days, 9.94 hours ago)

Redirect Domain Including Subdomains and Arguments

I used this as an include on every page to redirect every page incl arguments from .com to .de

PHP / redirect, subdomain, domain / by ThePeppersStudio (30 days, 6.09 hours ago)

PHP Contextual Dates

friendly contextual dates

PHP / contextual, date, friendly / by ThePeppersStudio (53 days, 4.19 hours ago)

Convert String To ASCII

避免多语言编码问题

PHP / convert, string, ascii / by ThePeppersStudio (115 days, 6.13 hours ago)

How to use the SQLite Objetct Oriented Interface

SQLite Object Oriented Interface for PHP

PHP / sqlite, oop / by ThePeppersStudio (127 days, 12.14 hours ago)

Handling Recursive Categories Hierarchical Data

Whether you want to build your own forum, publish the messages from a mailing list on your Website, or write your own cms: there will be a moment that you'll want to store hierarchical data in a database. And, unless you're using a XML-like database, tables aren't hierarchical; they're just a flat list. You'll have to find a way to translate the hierarchy in a flat file.

PHP / categories, hierarchical, tree, recursive / by ThePeppersStudio (139 days, 8.51 hours ago)

MySQL Safe Query to Prevent SQL Injection

PHP / mysql, safe, sql, injection / by ThePeppersStudio (139 days, 8.63 hours ago)

htmlSQL

htmlSQL is a experimental PHP class which allows you to access HTML values by an SQL like syntax. This means that you don't have to write complex functions (regular expressions) to extract specific values.

PHP / html, sql, parser / by ThePeppersStudio (154 days, 14.21 hours ago)