Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged php



6 1016 posted 16 years ago by LoRd1990
Add these lines to Drupals settings.php. Probably works on other systems, then Drupal too.
1 990 posted 16 years ago by berkes
0 680 posted 16 years ago by jpdamen
Easiest way to get the last day in the current month.
2 1009 posted 16 years ago by alli14404
Not mine. Changed from the original it to suit my needs.
2 850 posted 16 years ago by cubit
adapted from http://www.gotocode.com/art.asp?art_id=275&
0 1023 posted 16 years ago by clapfouine
1 861 posted 16 years ago by wintondeshong
Created for my own purposes, thought I'd share though ;) copy paste at the top of your file and it does the magic :)
31 6168 posted 17 years ago by peteypablonz
aun no acabado
2 643 posted 17 years ago by MartinY
5 813 posted 17 years ago by jrphelps
Genera links en base a http, www, ftp
2 927 posted 17 years ago by nicolaspar
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 924 posted 17 years ago by wattz
3 833 posted 17 years ago by JuliaKM
Just a reminder to myself, not really a snippet. When running into memory/speed issues with PHP/MySQL apps, adjust the memory_limit parameter in php.ini.
3 681 posted 17 years ago by Todd
How to check if a number is odd or even in PHP. Could also use the MOD (%) function, but apparently this method is better performance-wise.
12 1391 posted 17 years ago by andyhartleeds
17 5012 posted 17 years ago by lmcdougall
Ej: $ziper = new zipfile(); $filename1 = 'images/imagen1.jpg'; $filename2 = 'images/imagen2.jpg'; $fileZip = 'images/imagen.zip'; $ziper->addFile(file_get_contents($filename1),$filename1); $ziper->addFile(file_get_contents($filename2),$filename...
22 4975 posted 17 years ago by lmcdougall
A quick and simple way to search a MySQL database. Example: mysql_search('items', 'title tags', isset($_GET['q'])?$_GET['q']:'', Array('columns'=>'*', 'method'=>'OR', 'extra_sql'=>'AND active = "true" ORDER BY id DESC'));
5 1055 posted 17 years ago by lmcdougall
Shortens a string, and adds a span with a title of the full string. Function is useful for listings where you don't want wraping; or for places where a long string liek a username can break the layout.
1 921 posted 17 years ago by berkes
2 797 posted 17 years ago by nicolaspar
0 1854 posted 17 years ago by nicolaspar
Inserts the values of an array into a table. Also supports specifying if a specific field needs to be encoded using PASSWORD() Parameters: Table: Name of table to insert into Data: array of $field->$value of new data Password Field: Which field i...
3 2548 posted 17 years ago by depmed
0 759 posted 17 years ago by eethann
2 806 posted 17 years ago by eethann
Was fiddling around at work one day thought this might be useful.
9 3326 posted 17 years ago by djdykes
Put classes around your bodyy, to allow different colors for seperate pages and areas on your site. IT will simply add a css-safe version of the first argument in an url. Say the url is /about_us/our_company the class will be body.about-us Require...
2 790 posted 17 years ago by berkes
The original code was meant to be used with register_globals=on. If you cannot or don't want to turn that on, then I have modified the code to work with register_globals=off.
4 857 posted 17 years ago by Jaymoon
echo ( browser_detection( 'number' ) .''. browser_detection( 'browser' ) .''. browser_detection( 'os' ) .''. browser_detection( 'os_number' ) ); Outputs (browser version, browser, os, os number): 1.5 moz nt 5.1 if ( ( browser_de...
2 1120 posted 17 years ago by llbbl