×
1 Choose EITC/EITCA Certificates
2 Learn and take online exams
3 Get your IT skills certified

Confirm your IT skills and competencies under the European IT Certification framework from anywhere in the world fully online.

EITCA Academy

Digital skills attestation standard by the European IT Certification Institute aiming to support Digital Society development

LOG IN TO YOUR ACCOUNT

CREATE AN ACCOUNT FORGOT YOUR PASSWORD?

FORGOT YOUR PASSWORD?

AAH, WAIT, I REMEMBER NOW!

CREATE AN ACCOUNT

ALREADY HAVE AN ACCOUNT?
EUROPEAN INFORMATION TECHNOLOGIES CERTIFICATION ACADEMY - ATTESTING YOUR PROFESSIONAL DIGITAL SKILLS
  • SIGN UP
  • LOGIN
  • INFO

EITCA Academy

EITCA Academy

The European Information Technologies Certification Institute - EITCI ASBL

Certification Provider

EITCI Institute ASBL

Brussels, European Union

Governing European IT Certification (EITC) framework in support of the IT professionalism and Digital Society

  • CERTIFICATES
    • EITCA ACADEMIES
      • EITCA ACADEMIES CATALOGUE<
      • EITCA/CG COMPUTER GRAPHICS
      • EITCA/IS INFORMATION SECURITY
      • EITCA/BI BUSINESS INFORMATION
      • EITCA/KC KEY COMPETENCIES
      • EITCA/EG E-GOVERNMENT
      • EITCA/WD WEB DEVELOPMENT
      • EITCA/AI ARTIFICIAL INTELLIGENCE
    • EITC CERTIFICATES
      • EITC CERTIFICATES CATALOGUE<
      • COMPUTER GRAPHICS CERTIFICATES
      • WEB DESIGN CERTIFICATES
      • 3D DESIGN CERTIFICATES
      • OFFICE IT CERTIFICATES
      • BITCOIN BLOCKCHAIN CERTIFICATE
      • WORDPRESS CERTIFICATE
      • CLOUD PLATFORM CERTIFICATENEW
    • EITC CERTIFICATES
      • INTERNET CERTIFICATES
      • CRYPTOGRAPHY CERTIFICATES
      • BUSINESS IT CERTIFICATES
      • TELEWORK CERTIFICATES
      • PROGRAMMING CERTIFICATES
      • DIGITAL PORTRAIT CERTIFICATE
      • WEB DEVELOPMENT CERTIFICATES
      • DEEP LEARNING CERTIFICATESNEW
    • CERTIFICATES FOR
      • EU PUBLIC ADMINISTRATION
      • TEACHERS AND EDUCATORS
      • IT SECURITY PROFESSIONALS
      • GRAPHICS DESIGNERS & ARTISTS
      • BUSINESSMEN AND MANAGERS
      • BLOCKCHAIN DEVELOPERS
      • WEB DEVELOPERS
      • CLOUD AI EXPERTSNEW
  • FEATURED
  • SUBSIDY
  • HOW IT WORKS
  •   IT ID
  • ABOUT
  • CONTACT
  • MY ORDER
    Your current order is empty.
EITCIINSTITUTE
CERTIFIED

What are the three types of arrays in PHP?

by EITCA Academy / Tuesday, 08 August 2023 / Published in Web Development, EITC/WD/PMSF PHP and MySQL Fundamentals, PHP data structures, Arrays, Examination review

In the field of Web Development, specifically PHP and MySQL Fundamentals, arrays are an essential data structure that allows programmers to store and manipulate multiple values in a single variable. PHP provides various types of arrays to cater to different requirements and scenarios. In this context, there are three main types of arrays in PHP: indexed arrays, associative arrays, and multidimensional arrays.

1. Indexed Arrays:
Indexed arrays, also known as numerically indexed arrays, are the simplest and most common type of arrays in PHP. In an indexed array, each element is assigned a unique numerical index starting from zero. These indexes serve as the keys to access the corresponding elements. The elements within an indexed array can be of any data type, including integers, strings, floats, or even other arrays.

Let's consider an example to illustrate an indexed array:

$fruits = array("Apple", "Banana", "Orange");

In this case, the array "$fruits" contains three elements, with indexes 0, 1, and 2. To access or modify a specific element, you can use its corresponding index. For instance, to access the second element (Banana), you would use:

echo $fruits[1]; // Output: Banana

2. Associative Arrays:
Associative arrays, also known as key-value pairs, allow programmers to associate specific keys with their corresponding values. Unlike indexed arrays, where the keys are numerical, associative arrays use string keys. This type of array is particularly useful when you want to access elements based on their unique identifiers or names.

Let's consider an example to illustrate an associative array:

$student = array("name" => "John", "age" => 20, "grade" => "A");

In this case, the array "$student" contains three elements, with keys "name", "age", and "grade". To access or modify a specific element, you can use its corresponding key. For instance, to access the student's age, you would use:

echo $student["age"]; // Output: 20

3. Multidimensional Arrays:
Multidimensional arrays are arrays that contain other arrays as their elements. They are used to represent complex data structures, such as tables or matrices. In PHP, multidimensional arrays can be created by nesting arrays within arrays, creating a hierarchical structure.

Let's consider an example to illustrate a multidimensional array:

$matrix = array(
    array(1, 2, 3),
    array(4, 5, 6),
    array(7, 8, 9)
);

In this case, the array "$matrix" is a 3×3 matrix represented as a multidimensional array. To access or modify a specific element, you need to specify both the row and column indexes. For instance, to access the element in the second row and third column (6), you would use:

echo $matrix[1][2]; // Output: 6

PHP provides three main types of arrays: indexed arrays, associative arrays, and multidimensional arrays. Indexed arrays use numerical indexes to access elements, associative arrays use string keys, and multidimensional arrays contain other arrays as their elements. Understanding these array types is important for effectively managing and manipulating data in PHP.

Other recent questions and answers regarding Arrays:

  • How do we access elements in an associative array?
  • How can we add a new element to the end of an indexed array?
  • What are the two ways to create an indexed array in PHP?
  • How do we access a specific value in an indexed array?

More questions and answers:

  • Field: Web Development
  • Programme: EITC/WD/PMSF PHP and MySQL Fundamentals (go to the certification programme)
  • Lesson: PHP data structures (go to related lesson)
  • Topic: Arrays (go to related topic)
  • Examination review
Tagged under: Arrays, Data Structures, MySQL, PHP, Web Development
Home » Arrays / EITC/WD/PMSF PHP and MySQL Fundamentals / Examination review / PHP data structures / Web Development » What are the three types of arrays in PHP?

Certification Center

USER MENU

  • My Account

CERTIFICATE CATEGORY

  • EITC Certification (105)
  • EITCA Certification (9)

What are you looking for?

  • Introduction
  • How it works?
  • EITCA Academies
  • EITCI DSJC Subsidy
  • Full EITC catalogue
  • Your order
  • Featured
  •   IT ID
  • EITCA reviews (Medium publ.)
  • About
  • Contact

EITCA Academy is a part of the European IT Certification framework

The European IT Certification framework has been established in 2008 as a Europe based and vendor independent standard in widely accessible online certification of digital skills and competencies in many areas of professional digital specializations. The EITC framework is governed by the European IT Certification Institute (EITCI), a non-profit certification authority supporting information society growth and bridging the digital skills gap in the EU.

Eligibility for EITCA Academy 80% EITCI DSJC Subsidy support

80% of EITCA Academy fees subsidized in enrolment by

    EITCA Academy Secretary Office

    European IT Certification Institute ASBL
    Brussels, Belgium, European Union

    EITC / EITCA Certification Framework Operator
    Governing European IT Certification Standard
    Access contact form or call +32 25887351

    Follow EITCI on X
    Visit EITCA Academy on Facebook
    Engage with EITCA Academy on LinkedIn
    Check out EITCI and EITCA videos on YouTube

    Funded by the European Union

    Funded by the European Regional Development Fund (ERDF) and the European Social Fund (ESF) in series of projects since 2007, currently governed by the European IT Certification Institute (EITCI) since 2008

    Information Security Policy | DSRRM and GDPR Policy | Data Protection Policy | Record of Processing Activities | HSE Policy | Anti-Corruption Policy | Modern Slavery Policy

    Automatically translate to your language

    Terms and Conditions | Privacy Policy
    EITCA Academy
    • EITCA Academy on social media
    EITCA Academy


    © 2008-2025  European IT Certification Institute
    Brussels, Belgium, European Union

    TOP
    Chat with Support
    Chat with Support
    Questions, doubts, issues? We are here to help you!
    End chat
    Connecting...
    Do you have any questions?
    Do you have any questions?
    :
    :
    :
    Send
    Do you have any questions?
    :
    :
    Start Chat
    The chat session has ended. Thank you!
    Please rate the support you've received.
    Good Bad