Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged php



1 ... 7 8 9 10 11 ... 58
A regular expression for removing <br> and <br> (case insensitive) between HTML elements if there is no content between the HTML elements. It was written for fixing extra line spaces created in a WordPress visual editor after the content of the visu...
0 597 posted 11 years ago by pumpkinthehead
This will generate a random alpha numeric string 20 characters long.
1 826 posted 11 years ago by _reydin_
replace special characters
0 658 posted 11 years ago by Narayon
Just a small function to sanitize the user's input of any xss and sqli. I saw a lot of ones that didn't include htmlentities or htmlspecialchars, and were still vulnerable to persistent/reflected xss.
1 608 posted 11 years ago by TheNullByte
Extracts the video title & download URL from a youtube page and starts a download.
3 1180 posted 11 years ago by codespartan
For a project I needed to generate a unique code for each user the client would input manually. Each user would have four fields (first name, last name, email, zipcode). Omitting the email addresses ensures unique output because we reduce the chances...
0 472 posted 11 years ago by fmdfrank
when someone trying to or two conditions using active record database library in codeigniter
0 641 posted 11 years ago by pruntrut
http://www.binarymoon.co.uk/2009/10/timthumb-wordpress-mu/
0 544 posted 11 years ago by rabc
Example calculate yesterday, but if you multiply by some number you can get in an easy way, weeks, months or years
0 833 posted 11 years ago by satie83
HTTP headers to disable caching.
1 769 posted 11 years ago by ryantxr
0 733 posted 11 years ago by shufflepath
If contents is "page-name" do stuff
1 455 posted 11 years ago by akmuraro
Checks for fake DNS as well as utilizes regex functions to check the string for proper length & characters.
0 1030 posted 11 years ago by thewickedchemist
Add this snippet to the functions.php of your wordpress theme. This will add a select menu with an automatically generated list of your shortcodes for your pages and posts.
1 537 posted 11 years ago by planetabhi
This snippet will enable you to add shortcode to a wordpress custom field. Normally wordpress does not run shortcodes that you put into a custom field. Just put this code into whatever page you are displaying the results of the shortcode, and change...
0 770 posted 11 years ago by leeboyce
Takes titles from a certain category and lists them in an unordered list.
0 607 posted 11 years ago by thewickedchemist
You can save this function in your common function file of config file, which must be included in the page which source code you want to see and simply add kode to the end of the URL and see the complete PHP code of that file on browser
0 911 posted 11 years ago by xkeshav
For those cases where you want to code in PHP but need to deploy to ASP. It doesn't account for php logic but only converts the php include() statements into SSI includes. Could be useful for converting basic websites from php to asp, rare but it hap...
0 842 posted 11 years ago by crypticsoft
Random color hex
0 726 posted 11 years ago by pruntrut
Remove specific words from a string
0 786 posted 11 years ago by pruntrut
Converts phone numbers to the formatting standard
1 612 posted 11 years ago by pruntrut
Change string first letter to uppercase
0 630 posted 11 years ago by pruntrut
List all files in a diretory with glob
0 822 posted 11 years ago by pruntrut
Capture Web Screenshots easily with the [GrabzIt ](http://grabz.it/) PHP API You will need the free [GrabzIt Code Library](http://grabz.it/api/php/download.aspx) to get started.
2 649 posted 11 years ago by Maximus1983
test create new snippet
0 896 posted 11 years ago by bindirtit
You can set this as a cron to automatically clean up unsubscribes after sending out a mass email.
0 636 posted 11 years ago by squadsupply
Using array_map() on multidimensional arrays
0 1153 posted 11 years ago by pruntrut
The following shoud do it. pass the array, index is what element you want to sort on (in your case use 3). Then you can sort asc or desc, and weather you want to use natural sorting (the way a human would sort, 2 before 10) and lastly case sensitive...
0 606 posted 11 years ago by pruntrut
$asciiData = preg_replace( '/[\x7f-\xff]/', '', $dirtyData );
0 508 posted 11 years ago by jgomez
1 ... 7 8 9 10 11 ... 58