Welcome To Snipplr
Everyone's Recent PHP Snippets Tagged php
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
This snippet will create an array of all images in a directory and sub-directories and display them randomly.
4
3421
posted 15 years ago by superuntitled
Manipulates XML nodes using PHP's Dom library. Includes XPath navigation, child manipulation, and deletion of current document.
0
742
posted 15 years ago by mikeevans
Include file that contains the array of areacodes and states. **This file is needed for the Areacode Script to work. Script here: http://snipplr.com/view/17339/area-code-lookup-script/
2
720
posted 15 years ago by arnoldb
This simple script will return what state an areacode belongs to. Be sure to get the include file that contains the array here: http://snipplr.com/view/17340/area-code-lookup-script--include-file/
1
810
posted 15 years ago by arnoldb
A few days ago i was looking for a script witch one will help me to unzip a file using PHP . There is 2 different ways to do it.One just execute a commend to unzip the file in the shell using PHP and another one is using library functions
2
905
posted 15 years ago by fackz
Save this file as a .php somewhere on your webserver - NOT A WEB ACCESSIBLE LOCATION! Edit the lines in the top portion to suit your needs and call the file from bash like this: $> php cpanel-backup.php
You can use a cronjob to make this run autom...
1
907
posted 15 years ago by arnoldb
How to replace sleep(2), for your PHP code. Ideal testing hosting/dns ping.
1
918
posted 15 years ago by nicolaspar
Takes advantage of the SPL. Much easier and maintainable than the previous revisions. Haven't done any benchmarks yet but I imagine it is much faster. "If you want to omit directories, remove the RecursiveIteratorIterator::SELF_FIRST part."
3
668
posted 15 years ago by DrewDouglass
All credit for this snippet goes to Roshan, link is given above.
4
1184
posted 15 years ago by DrewDouglass
More info found in the link above, basically, you can replace the $config['base_url'] to the snippet below and you no longer need to set the base url. Useful for making your application more portable.
7
937
posted 15 years ago by DrewDouglass
Thanks to James Padolsey for sharing this script with everyone on his blog, link above.
0
627
posted 15 years ago by DrewDouglass
All credit for this code goes to the all mighty Fou-Lou of codingforums.com (link given).
0
1839
posted 15 years ago by DrewDouglass
Need a function to clean your _POST array before inserting into a database? Just pass $_POST to this function.
1
1106
posted 15 years ago by the_dev
It's easy to print out an array that is readable and with only one line of code. This can easily be turned into a nifty function.
1
638
posted 15 years ago by the_dev
Here is the correct way to turn your mysql results into an array. Forget the other nonsense of useless code. Why type out this long code: "for($i = 0; $array[$i] = mysqli_fetch_assoc($result); $i++) ;" when you can accomplish the same thing with m...
1
1022
posted 15 years ago by the_dev
There's another snippet on here that always comes up on google for finding the relative path to the root, but it doesn't work very well. This version will work from the root, from any subdirectory, and with malformed path names such as www.example.co...
3
1206
posted 15 years ago by blackhole12
This little bit of code is a calculator of the "golden mean" of a given length of time. For example: given a length of 1 minute and 0 seconds, the answer given will be 0:00:37. See U2's "With or Without You", the Greek Parthenon, the human body, etc....
1
1072
posted 15 years ago by rossuber
All you need to do when writing the post, is enter a custom field with the key "expiration" and set the value in the format: "2010/01/01 18:20:00" - this would expire the post at 6.20pm on the 1st January 2010.
1
744
posted 15 years ago by gjindancer