Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged array



« Prev 1 2 3 4 5 6
A quick snippet to rotate a series of words on page load using PHP.
1 18066 posted 5 years ago by danparks
php list all files of a given directory
0 3521 posted 6 years ago by martinbrait
Convert easily XML File or String to Associative Array in PHP
0 2796 posted 9 years ago by kavikms
Sort & query arrays in PHP. Sort multi dimensional arrays by object properties and filter the array by specific criteria. Documentation: https://github.com/mattnicholson/DataList
1 1603 posted 10 years ago by mattnicholson
Works with any array
0 2598 posted 10 years ago by a1ias
shows how to use array_map to mine data from nested arrays.
0 2279 posted 11 years ago by ryantxr
I created this code for practice, and I looking for better and clear solution for the last instance where I can write or delete the data, but after I want to get back the content as array or the key as string. I want to use this write-read back with...
0 2478 posted 11 years ago by gitarfogas
Creating a nested array from items with parent IDs. This is useful for when you have a website working with multiple categories with parent categories. But it can be applied anywhere, really!
0 3033 posted 11 years ago by CreativePunch
Traverses a multidimensional array and returns an array with the results. It also echoes the result as a string just for demonstration.
0 2196 posted 12 years ago by gummiost
Search recursive in array
1 2214 posted 12 years ago by bigmichiel
This snippet is a lambda function (anonymous function) to create an xml from an array. It uses recursiveness.
1 2445 posted 12 years ago by abrahamsustaita
This table is based on the ISO 2 letter (Alpha-2 code, ISO 639-1) and 3 letter (Alpha-3 code, ISO 639-2) Standard Codes for the Representation of Names of Languages.
0 1981 posted 12 years ago by rwt
Checks if two given arrays equal each other as php doesn't have a built in function for this.
0 2161 posted 12 years ago by MaxHudson
Outputs the content of a multi-dimensional array in the $GLOBALS['lv']
0 1471 posted 12 years ago by steho
Use it similar to in_array function of PHP.
0 1512 posted 12 years ago by kosinix
Function to convert a one dimensional array to two dimensional with option to specify how many columns. Returns two dimensional array on success or false on fail.
0 2931 posted 13 years ago by kosinix
Sum all elements of a bidimensional or multi-dimensional array with an assigned key
0 1498 posted 13 years ago by eortiz
I use this primarily for debugging purposes. This simply takes an array and creates an expandable item that prints the array out in a \<pre\> wrapping, making it easy to read. Very basic snippet.
0 2408 posted 13 years ago by ringo380
Search recursively some value in array with the key name
0 1314 posted 13 years ago by MonsterDev
Using array_map() on multidimensional arrays
0 1744 posted 13 years ago by pruntrut
The following shoud do it. pass the array, index is what element you want to sort on (in your case use 3). Then you can sort asc or desc, and weather you want to use natural sorting (the way a human would sort, 2 before 10) and lastly case sensitive...
0 1158 posted 13 years ago by pruntrut
sort a multidimensional array by field
0 1314 posted 13 years ago by akt
sort a multidimensional array by field
0 1259 posted 13 years ago by akt
A nice way to do sorting of a key on a multi-dimensional array - DavidG
0 1493 posted 13 years ago by satie83
If you want to use this in a class, change the last line to: ` return array_map(array($this, __FUNCTION__), $object ); `
0 1158 posted 13 years ago by jgomez
Converts a php object to an associative array
1 5423 posted 13 years ago by satie83
Writing an PHP array in a javascript file with json_encode.
0 1654 posted 13 years ago by Narayon
This sorts a multi-dimensional array by one of the values in the array. Sorts in Desc order (most recent date first).
0 1363 posted 13 years ago by bitsculptor
Very helpful function for sorting multi-dimensional arrays
0 1363 posted 13 years ago by chasecrawford
Ordena Array Bidimensional Asociativo de acuerdo a parametro del array.
0 1119 posted 13 years ago by serialk89
« Prev 1 2 3 4 5 6