Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged array



0 1165 posted 13 years ago by metoikos
1 634 posted 13 years ago by iloveitaly
After i saw this snippet http://snipplr.com/view/33790/form-country-code-select-with-if-selected-test/ i wanted to make the code better :D To make it easier to maintain
0 751 posted 13 years ago by cigraphics
The first argument is a variable name which value should be extracted from $array (second argument), or array of keys (multidim array is also supported). The third argument is a default value which will be return on fail (false by default). Usage...
0 704 posted 13 years ago by and
split_to_chunks splits the string up into an array with elements containing 140 characters <b>or less</b>. This enables you to keep words intact when sending automated twitter messages. $to is needed in order to subtract from 140 the amount of cha...
0 836 posted 13 years ago by s0l1dsnak3123
This function takes an array and a key that is unwanted. It will recurse through and unset the key in the argument array and all its sub-arrays.
0 599 posted 13 years ago by thesmart
i could put a demo of this in action if you want
0 786 posted 14 years ago by abbey
I include this in anything I'm developing, so I can easily inspect the contents of arrays and objects.
0 635 posted 14 years ago by joshuamilford
Orders a multi-dimensional array by one of it's fields. There is also the option to treat this like an SQL-style 'order by' query with the $field value passed in (ie. 'user_id desc') to do reverse ordering.
0 455 posted 14 years ago by browncardigan
1 476 posted 14 years ago by rccc
Array associativa de estados brasileiros com sigla pra chave e nome para valor.
0 774 posted 14 years ago by rudwolf
A utility function to preserve an array in a session. Adding the newest element to the beginning of the array and popping out the last one. Useful for displaying for instance; your last searches option in your website.
1 734 posted 14 years ago by Heroftime
Searches all array elements for a given substring. Returns an array of found key=>value pairs or false if not found.
0 574 posted 14 years ago by lancemonotone
Simple function that sorts a bi-dimensional array by one of it keys.
1 835 posted 14 years ago by AlejoLuc
1 765 posted 14 years ago by giak
0 657 posted 14 years ago by giak
1 489 posted 14 years ago by giak
0 783 posted 14 years ago by giak
0 632 posted 14 years ago by unravelme1
This is a class/demonstration for creating dynamic properties and storing them in an array
1 516 posted 14 years ago by mpcircuitry
Before: ` Array ( [0] => Array ( [total_sessions] => 24 [study_type_id] => 1 ) [1] => Array ( [total_sessions] => 24 [study_type_id] => 2 )...
0 507 posted 14 years ago by iloveitaly
A script I used for quickly load a file (see line 3) and then make a table which had linenumbers on each line. You may want to add a +1 when its generating the table...
0 634 posted 14 years ago by Knarf
For more information, see php.net, under usort It works with dates Replace 0 for the array's key you want to sort. For example, if you have a start_date array key you would like to compare, then you would replace 0 for start_date. If you wan...
0 730 posted 14 years ago by leonelsantos
A function i made for running trim on all elements in an array
1 764 posted 14 years ago by Knarf
Create log.txt in scripts directory and set permissions to 0666 before use.
0 582 posted 14 years ago by Nek
without scandir() function
0 503 posted 14 years ago by stancox