Creating an Array: Difference between revisions

Content added Content deleted
(Added Clean example)
No edit summary
Line 340:
#You would call the array by this code. This will call the 3rd 1 on the second list
echo $array[1][3];
 
==[[Pike]]==
[[Category:Pike]]
For a single dimension int array:
array(int) x = ({ 1, 2, 3 });
 
For a single dimension of any type you declare array(mixed) instead of array(int), or just array:
array x = ({ "a", 1, 5.2 });
 
For a multi-dimension array, you build an array of arrays:
mixed x = ({ ({ 5 }),({ 3, 2 }), ({ 1, 8 }) });
 
Note that inner arrays can be of different sizes, as are simply values of the outer array.
 
==[[Python]]==