Welcome To Snipplr


Everyone's Recent PHP Snippets



This was posted on the PHP website, I use it quite often. You may get a warning as it is an "unsafe" include (include($var)), but it's a risk that needs to be taken.
5 645 posted 16 years ago by jgeewax
Sends mail to the e-mail address specified. Supports attaching files, multi-part message, and e-mail encodings. Works well with Asian cell phones.
2 1051 posted 16 years ago by IanLewis
Recursively creates a directory.
1 595 posted 16 years ago by IanLewis
Parses the given path and creates a http redirect to that page.
1 817 posted 16 years ago by IanLewis
example: thumb.php?p=image.jpg&s=45
0 698 posted 16 years ago by iloveitaly
callback in a form alter to enforce an exposed filter to use only the options set in filter. Works for selectlists only.
2 620 posted 16 years ago by berkes
1 568 posted 16 years ago by d4rk
6 768 posted 16 years ago by cmslounge
2 523 posted 16 years ago by kotnik
This code is based on the ASP script posted by Lio. It will determine the time taken for a php script to execute correct to 0.000000000000001 seconds.
2 561 posted 16 years ago by kotnik
Simple way to check see if a file exists and is readable before you include it. Stops nasty error messages onscreen.
5 982 posted 17 years ago by 1man
Way to update the footer of a website automatically on 1st Jan.
3 694 posted 17 years ago by 1man
Very simple navigation. Style the id using CSS. Allows you to highlight the current page with CSS.
1 868 posted 17 years ago by 1man
1 577 posted 17 years ago by d4rk
Usage: $_POST = mysql_real_escape_array($_POST)
3 880 posted 17 years ago by d4rk
Not sure if this works yet
2 513 posted 17 years ago by Jargon
De aa-mm-dd a dd-mm-aa y al revé
3 696 posted 17 years ago by nicolaspar
A form alter implementation to create variables to flag certain features per node type. E.g. Show foo on blogs only: example_blog == 1;
1 489 posted 17 years ago by berkes
Me he basado en el combo que he encontrado en snippler por luman por eso empieza el índice en 2
3 926 posted 17 years ago by isaac
4 787 posted 17 years ago by dmarten
The above example uses PHP's heredoc syntax. With it, we can completely eliminate PHP tags from the insides of HTML tags.
1 1359 posted 17 years ago by juno
sorting, searching in array, some string function
0 579 posted 17 years ago by juno
This snippet is for use with image module, a small contributed module for image handling. (Yes: in Drupal you need a /contributed/ module for this o_O. The template snippet links the images to their own node.
2 598 posted 17 years ago by berkes
13 1426 posted 17 years ago by johnself
Returns an array of values specified for an enumerated MySQL field
2 953 posted 17 years ago by johnself
7 582 posted 17 years ago by frankyfish
0 495 posted 17 years ago by drwitt