You're best using the foreach construct to loop over your array. The following is untested and is off the top of my head (and probably therefore not as thought through as it should be!) but should give you a good start:

foreach ($mainArray as $event)
{
  print $event["eventTitle"];

  foreach ($event["artists"] as $artist)
  {
     print $artist["name"];
     print $artist["description"];

     $links = array();
     foreach ($artist["links"] as $link)
     {
       $links[] = $link["URL"];
     }
     print implode(",", $links);
  }
}
Answer from richsage on Stack Overflow
🌐
Tutorial Republic
tutorialrepublic.com › faq › foreach-loop-through-multidimensional-array-in-php.php
Foreach Loop through Multidimensional Array in PHP
Let's take a look at the following example to understand how it basically works: ... <?php // Multidimensional array $superheroes = array( "spider-man" => array( "name" => "Peter Parker", "email" => "peterparker@mail.com", ), "super-man" => array( "name" => "Clark Kent", "email" => "clarkkent@mail.com", ), "iron-man" => array( "name" => "Harry Potter", "email" => "harrypotter@mail.com", ) ); // Printing all the keys and values one by one $keys = array_keys($superheroes); for($i = 0; $i < count($superheroes); $i++) { echo $keys[$i] .
🌐
Matt Doyle
elated.com › home › blog › using multidimensional arrays in php
Using Multidimensional Arrays in PHP
July 23, 2022 - For each of those top-level elements, the inner loop moves through the array contained in the top-level element, and so on. Here’s an example that creates a 2-dimensional array of movie information, then loops through the array, displaying the information in the page: $movies = array( array( "title" => "Rear Window", "director" => "Alfred Hitchcock", "year" => 1954 ), array( "title" => "Full Metal Jacket", "director" => "Stanley Kubrick", "year" => 1987 ), array( "title" => "Mean Streets", "director" => "Martin Scorsese", "year" => 1973 ) ); foreach ( $movies as $movie ) { echo '<dl style="margin-bottom: 1em;">'; foreach ( $movie as $key => $value ) { echo "<dt>$key</dt><dd>$value</dd>"; } echo '</dl>'; }
🌐
Learning About Electronics
learningaboutelectronics.com › Articles › How-to-loop-through-a-multidimensional-array-in-PHP.php
How to Loop Through a Multidimensional Array in PHP
Because multidimensional arrays are basically arrays nested inside other arrays, all we have to do to loop through them is use nested loops. Running the above PHP code, we get the following output below.
🌐
W3Schools
w3schools.com › php › php_arrays_multidimensional.asp
PHP Multidimensional Arrays
For a three-dimensional array you need three indices to select an element · To loop through a multidimensional array, use a for loop or a foreach loop.
🌐
sebhastian
sebhastian.com › php-foreach-multidimensional-array
How to loop through a multidimensional array using foreach in PHP | sebhastian
December 2, 2022 - When you have a multidimensional array, you can use the foreach construct to loop through that array. You need to use two foreach statements as shown in the following code: <?php // A multidimensional array of user data $users = [ [ "id" => ...
🌐
Java2s
java2s.com › Tutorials › PHP › Array › PHP_Loop_Through_Multidimensional_Array.htm
PHP Loop Through Multidimensional Array
Multidimensional arrays are basically arrays nested inside other arrays, we can loop through multidimensional arrays using nested loops! We can use the following nested foreach statements to loop through multidimensional array. foreach ( $myBooks as $book ) { //from j a v a2s. c om foreach ...
🌐
Delft Stack
delftstack.com › home › howto › php › php foreach multidimensional array
How to Use Foreach Loop in Multidimensional Array in PHP | Delft Stack
February 2, 2024 - Inside the nested loops, print the variables $num, $number, and $value as shown in the example below. Therefore, we can use the nested foreach loop to access the elements of a multidimensional array in PHP.
Find elsewhere
🌐
YouTube
youtube.com › watch
How to loop through a Multidimensional Array in PHP | PHP Multidimensional Array Loop - YouTube
Hello, and welcome to Coder Gautam! Today I'm gonna show you how you can loop through a Multidimensional Array in PHP using the foreach loop! We will be usin...
Published   April 19, 2021
🌐
SitePoint
sitepoint.com › php
Advanced loops with multi-dimensional array - PHP - SitePoint Forums | Web Development & Design Community
April 5, 2012 - I’m fairly good in PHP so I understand the main concept of everything. One problem I cant seem to wrap my head around is random dimensions of multidimensional arrays with for loops using the key and value. Here is an exa…
🌐
DevOpsSchool.com
devopsschool.com › blog › loop-with-multidimensional-numeric-array
How to Print Multidimensional Numeric Array in PHP using loop? -
May 8, 2022 - Foreach Loop with Multidimensional Numeric:- You can use Nested Foreach loop through Multidimensional arrays in multiple arrays for store index value as Nested For Loop in PHP.
🌐
Codecademy
codecademy.com › forum_questions › 556d9d0ad3292f03fb000558
7/7 How to iterate through a multidimensional associative array? | Codecademy
<?php // On the line below, create your own associative array: $myArray=array(array('Ball'=>'blue','Triangle'=>'green'), array('Cube'=> 'red','Cylinder'=>'pink')); // On the line below, output one of the values to the page: foreach($myArray as $key=>$value) { echo $value . " ". $value. "<br/><br/>"; } // On the line below, loop through the array and output echo "<br/>" ?> ... Think of multidimensional arrays as tables.
🌐
GeeksforGeeks
geeksforgeeks.org › php › how-to-use-foreach-loop-with-multidimensional-arrays-in-php
How to Use Foreach Loop with Multidimensional Arrays in PHP? - GeeksforGeeks
July 23, 2025 - The basic syntax of a foreach loop in PHP is as follows: foreach ($array as $value) { // Code to be executed for each $value } To iterate through a multidimensional array using foreach loops, you can nest the loops for each level of the array.
🌐
Team Treehouse
teamtreehouse.com › community › php-looping-through-two-dimensional-array-using-for-loop
php looping through two dimensional array using for loop (Example) | Treehouse Community
February 9, 2017 - <?php $getUserName = $_POST['userName']; $getUserPassword = $_POST['pass_word']; //echo "user name: " .$getUserName. " <br>" . "password " . $getUserPassword; $array = array( 0 => array ( 'name' => 'Ellie', 'password'=> 'tr89ial' ), 1 => array( 'name' => 'greatGuy', 'password'=> 'abc123' ), 2 => array ( 'name' => 'blogger', 'password' => '23seventeen23' ) ); $arrayLength = count($array); for ($i = 0; $i < $arrayLength; $i++) { foreach($array[$i] as $value) { echo $value; } } ?>
🌐
Developer Drive
developerdrive.com › home › php arrays: array functions and multidimensional arrays
PHP Arrays: Array Functions and Multidimensional Arrays - Developer Drive
January 10, 2022 - For instance, the PHP code below: <? echo $arrBooks[‘Science Fiction][‘Title’]; echo "<br>"; echo $arrBooks[‘Horror’][‘Author’]; ?> ... The easiest way to loop through a multidimensional array is to nest two foreach loops; the outer loop goes through each outer array element, ...
🌐
ZetCode
zetcode.com › php › foreach
PHP foreach - looping over array in PHP with foreach statement
<?php $planets = [ "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune" ]; foreach ($planets as $planet): echo "$planet "; endforeach; echo "\n"; In the example, we loop over the array using the alternative syntax. We can use multiple foreach statements to loop over ...
🌐
Stack Overflow
stackoverflow.com › questions › 33831761 › looping-multidimensional-array-in-php
Looping multidimensional array in PHP - Stack Overflow
... foreach($inital_array as $key => $value) { foreach($value as $vkey => $vvalue) { var_dump($key); var_dump($vkey); var_dump($vvalue); //or do sth else } } Thats how you can loop through the array, not sure how you want to use the values though....