Skip to content

DataOps Blog

Just another DataOps site

  • Home
  • certification
  • consultant
  • consulting
  • Contact Us!
  • courses
  • Intro to Laravel
  • tools
  • trainer
  • training

PHP | Multidimensional arrays

December 31, 2021
By Manish Kumar In PHP

PHP | Multidimensional arrays

Pascal - Multi-dimensional Array

Multi-dimensional arrays is a type of arrays which stores an another array at each index instead of single element. In simple words, multi-dimensional arrays as array of arrays, every element in this array can be an array and they can also hold other sub-arrays within. Arrays or sub-arrays in multidimensional arrays can be accessed using multiple dimensions.
Dimensions of multidimensional array indicates the number of indices needed to select an element. For a two dimensional array two indices to select an element.

Associative array: Al associative array is similar to indexed array but instead of linear storage (indexed storage), every value can be assigned with a user-defined key of string type. Example :-

Output :-

Array
(
    [new1] => manishkumar
    [new2] => amitkumar
    [new3] => 19
    [new5] => 90
    [new6] => 1
    [new7] => 
    [new8] => 
)

19
90
1

Multidimensional Array : It is the form of multidimensional array. Initialization in Three-Dimensional array is same as that of Two-dimensional arrays. The difference is as the number of dimension increases so the number of nested braces will also increase.

Accessing multidimensional array elements: There are mainly two ways to access multidimensional array elements in PHP.

  • Elements can be accessed using dimensions as array_name[‘first dimension’][‘second dimension’].
  • Elements can be accessed using for loop.
  • Elements can be accessed using for each loop.

Output:-

1 Mukesh Manager Digital Marketing 50000
2 Nitesh Asst Manager Software Develoer 35000
3 Nilotma Senior Manager Tech team 76000
4 ritesh Junior Manager SEO 15000
5 Rakesh Area Manager Sales Marketing 40000


Emp IdEmp NameEmp DesignationEmp DepartmentEmp Salary
1MukeshManagerDigital Marketing50000
2NiteshAsst ManagerSoftware Develoer35000
3NilotmaSenior ManagerTech team76000
4riteshJunior ManagerSEO15000
5RakeshArea ManagerSales Marketing40000

;

Emp IdEmp NameEmp DesignationEmp DepartmentEmp Salary
1ManishManagerArea Manager73000
2KumarSenior ManagerTech team65000
3Kumari PujaJunior ManagerTechnical deptt66000
4Nillu KumariAsst ManagerSoftware Devloper35000
5Sita prasadSoftware DeveloerSales Area Manager48000

Copy code and use it by yourself on your editor for better understanding of Output.

Thank You !!

composer css html javascript jquery Laravel laravel-form MySQL php xampp
Written by:

Manish Kumar

View All Posts

Recent Posts

  • The Online Dating Association (ODA) Maintains the Gold Standard for online dating sites in britain
  • Tips Balance On The Internet And Typical Dating
  • meet black gay men Gay Hookups
  • (no title)
  • (no title)
  • Online Casinos Offer No Deposit Casino Bonus Codes
  • A Board Website Review
  • How you can Remove Disease From ipad device
  • Dating – When You Should Discuss Dirty Little Methods?
  • How to Find the Top Canadian Online Casino
  • Research Papers For Sale
  • Free Slot Machine Games – Tips to Play Slots Free
  • (no title)
  • Why Use a VPN Online?
  • The very best GTA Games
  • DesignLab Xbox 360 – Create Your Very Own Controllers
  • Tips on how to Conduct Individual Businesses
  • Tips on how to Download the Best Android Programs
  • Finest Antivirus Totally free
  • VPN USA — Protect Your web Privacy and Unblock Geo-Restricted Content

Archives

Categories

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
  • Free Video Tutorials
  • DevOps School
  • Best DevOps
  • scmGalaxy
  • Artificial Intelligence
  • DataOps
  • AIOps
  • GuruKul Galaxy
  • DevOps Consulting
  • DevOps Freelancers
  • DevOps Trainer
  • Free Ebooks
  • School for Debugger
  • Holiday Landmark
  • Surgery Planet
  • My Hospital Now
  • My Medic Plus
  • ProfessNow
  • Cotocus
  • Stocks Mantra
  • I Reviewed

Proudly powered by WordPress | Theme: BusiCare by SpiceThemes