Welcome To Snipplr
Everyone's Recent PHP Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Basically what this algorithm does is to replace the first letter of the serial number by a number (each letter represents where the banknote is originally from), then it calculates the sum of all digits. If the remaining of the division of that sum...
0
482
posted 16 years ago by j_junyent
Sets a module's weight to the lowest number. This assures that your module is ran before all other modules. Userfull if you want your implementation of a hook to be ran first.
Add this to your .install file. Replace your_modulename with the name of...
2
635
posted 16 years ago by berkes
Add these lines to Drupals settings.php. Probably works on other systems, then Drupal too.
1
825
posted 16 years ago by berkes
Searches an array $haystack for $needle. Returns the value of the element which contains the first result. Use strstr_array() for case-sensitive searches and stristr_array() for case-insensitive searches.
1
1781
posted 16 years ago by engel
Add this template before functions in a library, in order to give a good description of what it is and what it does. Replace all in < and > with your values.
2
788
posted 16 years ago by engel
Pass a user-inputted variable to this function in order to prevent SQL injection. Example:
mysql_query("INSERT INTO table VALUES('" . sql_sanitize($_POST["variable") . "')");
Instead of:
mysql_query("INSERT INTO table VALUES('" . $_POST["var...
34
4675
posted 16 years ago by engel
ej:
echo keepqsSinParametro('hola','hola=mundo&mundo=lindo&hola=chau'); #out = mundo=lindo
0
665
posted 16 years ago by nicolaspar
Created for my own purposes, thought I'd share though ;)
copy paste at the top of your file and it does the magic :)
31
5300
posted 16 years ago by peteypablonz
These two functions allow you to remove images from html page.
The function returns an array of images with the absolute src and,if there are any, the alt and title attributes.
Arguments to pass to get_images() are $file = html source and $url = th...
3
923
posted 16 years ago by gandalf
Display first article one way and following ones a different way
3
702
posted 16 years ago by JuliaKM
Sometimes you need to have an ability to show limited number of elements in your select objects or sort elements by name or so. I figured out that this feature was added to object_select_tag later so that not everybody knows about that. This featureâ...
1
565
posted 16 years ago by ggb2g
MyActiveRecord is a stand alone db abstraction layer to simplify things between php and mysql. you can download the latest version from www.wattz.net
0
778
posted 16 years ago by wattz