Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged array



0 1079 posted 14 years ago by takel
A little function used to set cookies as arrays of values instead of single combinations key->value. Note that it saves values as a stack.
1 1224 posted 14 years ago by claudiowebdesign
0 1417 posted 15 years ago by lajlev
Useful when used with the google map directions function http://snipplr.com/view/15530/php-create-google-map-directions-link/
0 1489 posted 15 years ago by iloveitaly
This method is easy to write, but not very efficient, as you can imagine.
2 2400 posted 15 years ago by dyteq
Summary ======= A useful function for masking arrays. Very useful if you have a function or method that takes arguments in an array, and you would like to force that array to have a specific structure. Its also great for setting defaults due to...
0 1744 posted 15 years ago by RobertWHurst
Prints an array (recursive) as PHP code (can be pasted into a php file and it will work). Note: This function can process arrays with integers/strings/sub-arrays. It is impossible to process resources (they have a state), and while it is possible...
1 1557 posted 15 years ago by BrunoDeBarros
Simple function to store an array in a cookie. Uses JSON. To pull data out of cookie use 'json_decode()'. It can then be looped etc.
1 2103 posted 15 years ago by liamchapman
0 1190 posted 15 years ago by zreedeecom
0 1629 posted 15 years ago by zoranmk
Drupal snippet
0 1464 posted 15 years ago by apro2000
Nothing special. First snippet. :)
0 1364 posted 15 years ago by embrace
Used to make a Google Pie Chart, with optional labels and size from an array, using the array keys as the labels and the values for the data.
0 1240 posted 15 years ago by alexstone
Parameters: $array - haystack, $find-value - needle to check for duplicates
1 1331 posted 15 years ago by stz184
This is a simple 'text to array for output' script that I've used a few times for my clients. Hope you like!
0 1575 posted 15 years ago by chicagowebmanagement
searching for a date sort function I found: http://slevy1.wordpress.com/2010/06/30/sorting-date-strings-in-php/ and built my codeigniter helper call : $arrSortedDates = bubbleSort( $unsorted ); (previous->helper autoload)
0 1222 posted 15 years ago by lluisr
0 1019 posted 15 years ago by CJness
0 1138 posted 15 years ago by bedomax
This PHP code snippet searches a value in an array. Depending on use, one or all matching values and their belonged keys are removed.
3 1585 posted 15 years ago by DADU
Orders a multi-dimensional field (such as sorting multiple $orders by field 'id')
0 1400 posted 15 years ago by jmiller
Pass in object. Returns array.
0 1365 posted 15 years ago by jmiller
This PHP code snippet checks each integer in an array. If necessary, one or more leading zeros are added to an integer. Note that each integer becomes a string.
2 1705 posted 15 years ago by DADU
Courtesy of Dorphalsig on php.net (see URL above)
1 1311 posted 15 years ago by Moridin
like array_search but compares against a specific key in each element of the array
2 1423 posted 15 years ago by iloveitaly
0 1120 posted 15 years ago by iloveitaly
Functions to search from arrays as well as recursive arrays.
1 1184 posted 15 years ago by sarfraznawaz2005