An array is a data structure that holds a collection of values. Depending on the language, you access each value by a numeric index or by a key. Arrays are among the first structures programmers learn and among the most used, since lists of records, lookup tables, matrices and numerical datasets are all built on them.
The posts here cover several languages. PHP material explains indexed, associative and multidimensional arrays, the array() function and => syntax for key-value pairs, array operators such as union and identity comparison, and looping with for and foreach. Python posts compare lists, arrays, tuples, sets and dicts and include short coding exercises, such as printing the k largest elements or finding the adjacent pair with the largest product. NumPy coverage explains multidimensional arrays and fast numerical operations, and there are two sets of NumPy interview questions. There is also a fix for the common Laravel error about accessing an array offset on a null value.
These posts are useful for beginners learning data structures, for developers preparing for coding interviews, and for PHP or Python programmers who want working examples to copy and adapt.
Start here
- What is Arrays and use cases of Arrays? – Explains how arrays store elements by index, their features and common use cases.
- Python Tutorials: Difference between List & Array & Tuple & Set & Dict – Table comparing Python collections by mutability, ordering and data types.
- PHP 7 Fundamental Tutorial for Beginners – PHP Arrays? – Beginner walkthrough of indexed, associative and multidimensional arrays in PHP.
- What is the difference between numeric and associative array in loop with example? – Shows index-based and key-based access to PHP arrays in for and foreach loops.
- How can use Array Operators in PHP with Example? – Covers PHP array union, equality and identity operators and how key order affects results.
- What is Numpy and How it works? An Overview and Its Use Cases ? – Overview of NumPy arrays, architecture, use cases and alternatives for numerical Python.
- Python Example Code: Program for printing k largest elements in an array – Runnable Python exercise for practicing sorting and selection on arrays.
- PHP Laravel Error: Trying to access array offset on value of type null – Explains why null values trigger this array offset error and how to guard against it.
Latest Arrays articles
What is Arrays and use cases of Arrays?
What is Arrays? An array is a data structure that stores a collection of elements of the same data type in a sequential manner. Each element in…
Python Example Code: Find the pair of adjacent elements that has the largest product
Rajesh KumarI’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked…
Python Example Code: Program for printing k largest elements in an array
Rajesh KumarI’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked…
Python Tutorials: Difference between List & Array & Tuple & Set & Dict
List Array Tuple List is mutable Array is mutable Tuple is immutable A list is ordered collection of items An array is ordered collection of items A…
Python Tutorials: Data Types – List
Rajesh KumarI’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked…
What is Numpy and How it works? An Overview and Its Use Cases ?
What is Numpy ? NumPy is the central bundle for logical registering in Python. A Python library gives a complex cluster object, different determined objects (like concealed…
What is Numpy and How it works? An Overview and Its Use Cases
What is NumPy? Numpy is library for the Python programming language. NumPy is one of the most powerful Python libraries. It is a Python library that provides…
Top 50 Numpy interview questions and answers
1) What is Numpy? Ans: NumPy is a general-purpose array-processing package. It provides a high-performance multidimensional array object, and tools for working with these arrays. It is…
Top 50 interview questions and answers of Numpy
Introduction NumPy is the fundamental package for scientific computing in Python.NumPy arrays facilitate advanced mathematical and other types of operations on large numbers of data. Typically, such…
Array in PHP.
1. Array and Its Type in PHP (Click To Go) 2. Numeric Array, Array Function, and Double Array Operator in PHP (Click To Go) Sushant KumarWith MotoShare.in,…
How can I sort arrays and data in PHP?
PHP Functions For Sorting Arrays In the previous chapter you’ve learnt the essentials of PHP arrays i.e. what arrays are, how to create them, how to view…
PHP 7 Fundamental Tutorial for Beginners – PHP Arrays?
What is PHP Arrays Arrays are complex variables that allow us to store more than one value or a group of values under a single variable name….
PHP 7 Essential Guide- PHP adding to an array-
In this blog I am going to explain that how to adding array in PHP. So, as stated in the PHP documentation, if you’r only pushing a…
How to adding array in PHP in different ways?
In this blog I am going to explain that how to add array in PHP with different ways. I am talking about Arrays how different ways to…
Numeric Array, Array Function, and Double Array Operator in PHP.
Numeric Array Sample Program Output:- Rahul Array Function Array() function is used to create an array. Syntax $array_name = array(“value1″,”value2″,”value3”,……..); For Example $name = array(“Sushant”,”Rahul”,”Sameer”,”sujeet”); Note:- By…
Array and Its Type in PHP.
An array is a collection of data items stored under a single name. Array provides a mechanism for declaring and accessing several data items with only one…
How to Print Multidimensional Associative Array in PHP using loop with example?
Foreach Loop with Multidimensional Associative Array :- Multidimensional Associative Array is used to store using foreach loop arrays value where pairs arrays value can be an integer…
How to Print Multidimensional Numeric Array in PHP using loop?
For Loop with Multidimensional Numeric Array:- Multidimensional Array means one or more arrays have multple array values access. It can store numbers, string multiple array uses of…
What is Multidimensional array in PHP with Example?
Multidimensional Array is Arrays of Array means one arrays have multiple array. You can define as it have 2Dimensional ([][]), 3Dimensional ([][][]), 4Dimensional ([][][]), and etc. ex:-…
How can use Array Operators in PHP with Example?
Php union:- ($a+$b) = Work as union means if same value then replace left variable to right variable(for keys that exit both array) ex:- Php Equality:- Key…
What is the difference between numeric and associative array in loop with example?
For Loop with Numeric Array:- Numeric Array uses in For Loop for Declaration and Initialization as numeric index values are store and access. ex:- For Loop with…
PHP Laravel Error: Trying to access array offset on value of type null
Environment:Laravel Version: 5.5PHP Version: 7.4.0 Error stack trace:Message: Trying to access array offset on value of type null Sample code that gave me error:$filterConfig = $request->get(‘filterConfig’, null);$showAll…
Complete reference guide of PHP Arrays!
What is PHP Arrays Arrays are complex variables that allow us to store more than one value or a group of values under a single variable name….
Add each array element to the lines of a file in ruby
scmuser created the topic: Add each array element to the lines of a file in ruby Add each array element to the lines of a file in…
What is the way to iterate through an array in Ruby?
scmuser created the topic: What is the way to iterate through an array in Ruby? What is the way to iterate through an array in Ruby? This…
Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed
scmuser created the topic: Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed Create a Ruby…
Function in vb script
rajani created the topic: function in vb script Develop a function that accepts a string of names separated by comma add those names in an array and…
Questions over Arrays variable in perl
scmuser created the topic: Questions over Arrays variable in perl Hi, Could you please explain following questions in details.. 1. Various way to define and initialize Arrays…
Perl function to remove any element using value validation
rajeshkumar created the topic: perl function to remove any element using value validation perl function to remove any element using value validation Not Working – my @items…
Delete an element from array based on custom duplicate value
rajeshkumar created the topic: Delete an element from array based on custom duplicate value Hi, I am looking for some help in one scenario. Requirement: Through some…
Arrays: frequently asked questions
What is the difference between a Python list and an array?
A list is a built-in type that can hold values of mixed types. The array module stores values of a single numeric type more compactly, and NumPy arrays add fast vectorized math over multidimensional data.
What is an associative array in PHP?
An associative array uses named keys, usually strings, instead of numeric indexes, for example ['name' => 'Ana']. PHP arrays are ordered maps, so the same type handles both indexed and associative arrays.
What causes 'Trying to access array offset on value of type null'?
Since PHP 7.4, PHP reports an error when code reads an index from a variable that is null instead of an array. Fix it by checking the value with isset() or the ?? operator, or by making sure the function that should return an array does so.
Why are NumPy arrays faster than Python lists?
NumPy stores elements of one data type in contiguous memory and runs operations in compiled loops. Python lists store references to separate objects and are processed one element at a time by the interpreter.
