Welcome To Snipplr


Everyone's Recent Snippets Tagged php



You can combine them with this: http://snipplr.com/view/4848/underscore-strings/
0 7746 posted 15 years ago by Abe
Add these lines to Drupals settings.php. Probably works on other systems, then Drupal too.
1 579 posted 15 years ago by berkes
0 412 posted 15 years ago by jpdamen
Easiest way to get the last day in the current month.
2 619 posted 15 years ago by alli14404
Not mine. Changed from the original it to suit my needs.
2 542 posted 15 years ago by cubit
adapted from http://www.gotocode.com/art.asp?art_id=275&
0 659 posted 15 years ago by clapfouine
1 447 posted 15 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 3664 posted 15 years ago by peteypablonz
aun no acabado
2 390 posted 15 years ago by MartinY
SEE http://json.org/ for PHP JSON Libraries. grunt knuckle drag brute force ugly escapes for quotes make a php array a json string Produces trailing commas which some Javascript Librarys can't deal with.* _*NOOB NOTE [a comma is added at the...
2 719 posted 15 years ago by inkdeep
5 455 posted 15 years ago by jrphelps
Genera links en base a http, www, ftp
2 600 posted 15 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 612 posted 15 years ago by wattz
3 504 posted 15 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 433 posted 15 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 852 posted 15 years ago by andyhartleeds
Drupal snippet: outputs all theming variables of a content type or page. Add to template.php the following function: function _phptemplate_variables($hook, $vars) { return array('vars_data' => $vars); } then add the snippet to the relativ...
5 545 posted 15 years ago by marcoba
3 572 posted 15 years ago by lmcdougall
3 548 posted 15 years ago by lmcdougall
17 2658 posted 15 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 2943 posted 15 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 628 posted 15 years ago by lmcdougall
This takes about an hour in total to run on my machine, so give yourself enough time. Obviously the configure options will need to be tweaked to match your set up, but this works for me. This assumes you already have MySQL installed.
0 459 posted 15 years ago by micmath
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 546 posted 15 years ago by berkes
2 516 posted 15 years ago by nicolaspar
0 1160 posted 15 years ago by nicolaspar