PHP Code Snippets by Hawkee
(15)
This is a little snippet that will remove any non-ASCII characters from a string.
This code produces a sort box for any number of arbitrary criteria on any type of data you have in your database. For this particular example we've got a product sort where users can sort by price or
This will extract a zip file via PHP. Just be sure to set the $file and $path variables. $file represents the zip file name which may or may not contain a path. $path represents the directory to extract
This will assign font sizes to tags based on their counts. It tries to evenly distribute the font sizes among the tags while keeping all tags with the same counts under the same font size. The data needs
I thought this was pretty neat and useful. You can combine strtotime with the date function to create your own date verbally. This is just an alternative to using mktime that's a little more intuiti
This is a stand alone example of a review system. This is the administration page for entering and editing reviews. It'll create your table for you automatically, so all you need to do is change the
I found this to be useful in displaying HTML code in a textarea. Certain tags like the closing textarea tag will cause problems.
This is a ready to go PHP script that can be pasted into a blank .php document. Run it through your webserver after changing $myemail to the value of your E-Mail address. It also sends the referring
This generates two structures: a tree and a list of objects. Both are generated from the following standard parent/child database format:
- cat_id: primary key, auto_increment
- cat_title: name of
I use this almost every day. It's one of the most useful PHP debugging tools. You can print all of the contents of a variable (class, array or scalar) to get an idea of how the structure looks.
Tags:
printr
This will convert a sortable YYYY-MM-DD date into a more presentable date. $date can be set to any date as long as it fits this format.





