Array.prototype.range = function(a, b, step) { step = !step ? 1 : step; b = b / step; for(var i […]
Tag: array
Remove falsy values from array
Quickly filter crap values from an array with: Array.filter(Boolean) someArray = [{name: ‘Jon Snow’, age: ’20’}, undefined, 400, null, ‘from […]
PHP Map: Advanced methods
In this article we will learn about some of the frequently asked Php programming questions in technical like PHP Map: […]
How to get the first element of an array in Javascript – example
You can use this array-first open source component to to return the first element of any given array in Javascript. […]
Javascript array mutability
Just a quick reminder to folks that some JS array functions have very different behaviours and return types. var x […]
How to insert index and element into an array
Coding Problem : I am developing a loop to compare two tables in a database. The intention is to know […]
Separate equal values into an array
Coding Problem : Well I have the following array: $produtos2[] = array( “cod” => (int) 768, “nome” => “LOGITECH M535”, […]
Foreach Array by incrementing another array
Coding Problem : With a question about foreach and incrementing another helper to perform an insert in the database, see: […]
Handle CSV data in JavaScript
CSV to array of JS Objects I am working with large datasets of lat/lng coordinates and am given the data […]
Return with all the lines of the foreach
Coding Problem : I have the following script : <?php $recursos_data = array( array( “id” => “0”, “recurso_nome” => “madeira”, […]
Foreach within Foreach PHP
Coding Problem : I have the following code: $row = $twitterusers->selectUserAll(); foreach ($row as $fetch) { $users[] = $fetch; } […]
Case Insensitive Array search in PHP
I found this here: http://www.php.net/manual/en/function.array-search.php#101869 A case insensitive PHP array_search: array_search( strtolower($element), array_map(‘strtolower’,$array) );
Sort words with accents in PHP
Coding Problem : I am trying to alphabetize an array in PHP, where the key of each array position is […]
How can I format this array the way I want it?
Coding Problem : I am creating a Seeder for Laravel insert values into a N para N table. I’m setting […]
Everything you need to know about JavaScript Array
In this article, I will discuss everything you need to know about Array in JavaScript. So, Let’s get started 1. […]
What is the difference between array_replace and array_merge?
Coding Problem : I would like to know the difference between array_replace and array_merge , because in some cases the […]
PHP Array Accessor Gotcha / Unexpected behavior
Ok, so I’ve been programming in PHP since I was 15 (holy shit! 8 years!!!), and since I normally check […]
PHP: Short syntax for arrays
Just letting you guys know that now you can do this: $newSyntax = [ ‘key’ => ‘value’, ‘anotherKey’ => ‘anotherValue’ […]
PHP – Array – Vertical Keys for Horizontal
Coding Problem : Situation I have an array as follows: Array ( [1] => Array ( [tree] => Array ( […]
Array en un campo “hidden” de un Formulario
Hay que serializar el array para enviarlo por el URL o en un formulario en un campo “hidden” … Y, […]