Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
dvprog_07 [2019-09-26 11:05]
Daniel Viström
dvprog_07 [2019-09-26 11:27]
Daniel Viström
Line 21: Line 21:
 echo '<br><br>'; echo '<br><br>';
 print_r($names);  // Bra för att testa program, men inte det man vill få ut annars. print_r($names);  // Bra för att testa program, men inte det man vill få ut annars.
 +echo '<br>';
 echo $names[1] . '<br><br>'; // Andra namnet skrivs ut (index startar från 0). echo $names[1] . '<br><br>'; // Andra namnet skrivs ut (index startar från 0).
  
Line 29: Line 30:
   $i++;   $i++;
 } }
 +echo '<br>';
  
 $i=0; $i=0;
Line 53: Line 55:
 ]; ];
 print_r($ages); print_r($ages);
-echo $ages['Birgitta'] . '<br><br>';+echo '<br>'$ages['Birgitta'] . '<br><br>';
  
 $arr3 = [     // Kan innehålla flera olika saker. $arr3 = [     // Kan innehålla flera olika saker.
Line 61: Line 63:
    'colors' => ['Red','Green','Yellow'  // Array innuti en array.    'colors' => ['Red','Green','Yellow'  // Array innuti en array.
 ]; ];
 +echo '<pre>';
 print_r($arr3); print_r($arr3);
 +echo '</pre><br>';
 +
 echo $arr3['colors'][2];  // Först yttre nyckeln, sedan inre nyckeln. echo $arr3['colors'][2];  // Först yttre nyckeln, sedan inre nyckeln.