Welcome To Snipplr
Everyone's Recent PHP Snippets Tagged array
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
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
779
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
739
posted 14 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
867
posted 14 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
618
posted 14 years ago by thesmart
I include this in anything I'm developing, so I can easily inspect the contents of arrays and objects.
0
661
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
473
posted 14 years ago by browncardigan
Array associativa de estados brasileiros com sigla pra chave e nome para valor.
0
798
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
775
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
597
posted 14 years ago by lancemonotone
Simple function that sorts a bi-dimensional array by one of it keys.
1
872
posted 14 years ago by AlejoLuc
This is a class/demonstration for creating dynamic properties and storing them in an array
1
535
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
523
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
659
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
765
posted 14 years ago by leonelsantos
Create log.txt in scripts directory and set permissions to 0666 before use.
0
610
posted 14 years ago by Nek