Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:create:array [16.01.2015 11:56] – Added associative arrays adminen:create:array [18.11.2020 17:30] (current) – [Arrays] sophia.schauer
Line 11: Line 11:
 // create an array // create an array
 $a = array('one', 'two', 'three'); $a = array('one', 'two', 'three');
 +</code>
 +
 +Instead of the notation ''array()'' a short notation with square brackets is also possible. The function is identical.
 +
 +<code php>
 +// Create an array with square brackets
 +$a = ['one', 'two', 'three'];
 </code> </code>
  
Line 37: Line 44:
  
 <code php> <code php>
-$a = array()+$a = array();
 for ($i=0; $i<10; $i++) { for ($i=0; $i<10; $i++) {
   $a[] = $i + 1;   $a[] = $i + 1;
en/create/array.txt · Last modified: 18.11.2020 17:30 by sophia.schauer
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki