<html><body style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 12px;"><p>Hello Mark</p><p>From memory arrays in PHP are not true arrays but associative arrays; that is a set of key:value pairs (what some languages call a dictionary). From the syntax point of view they look like arrays in that the key can be an integer, hence a[3]=543, and becuase they are key:value pairs, the next item can be a[4] = "text".</p><p>What I'm calling a "true array" only has values stored in memory and the location of a particular element is calculated via the index, the calcuation being dependent on the type of element stored in the array, hence it must be of fixed size, hence of fixed data type. Elements in so called associative arrays are located by searching the key list. This means that "indexes" don't have to be contiguous, and don't even have to be integers. In some ways they are more like Pascal's records.</p><p>Associative arrays get interesting when you move into multi-dimensions. Elements in true 2D array can be imagined to be in a rectangular block with the row and column indexes being use to determine the location of any one element; a[1,2] etc. In some ways, a 2D associative array are best visualised as a set of arrays within an array. The first 'index' locates the 'row' (or maybe 'column') of elements (a linear 'array'), and the second 'index' locates the required element with in the row/column; hence the syntac often (always?) used: a[1][2].</p><p>Regards</p><p>Robert T-A<br /><br /></p><blockquote><br />----- Original Message -----<br /><div style="background:rgb(228,228,228);width:100%;"><div style="font-weight:bold;">From:</div> "Year 12 Software Development Teachers' Mailing List" <sofdev@edulists.com.au></div><br /><div style="font-weight:bold;">To:</div>"Year 12 Software Development Teachers' Mailing List" <sofdev@edulistscom.au><br /><div style="font-weight:bold;">Cc:</div><br /><div style="font-weight:bold;">Sent:</div>Fri, 12 Jun 2015 14:25:58 +1000<br /><div style="font-weight:bold;">Subject:</div>Re: [Year 12 SofDev] Arrays with mixed data types<br /><br /><br /><div dir="ltr">I'm not familiar with the inner workings of PHP, but my research suggests their 'arrays' are not exactly the same nature as most other languages.<div>
<br /><div>It's sort of like when TV guides categorise 'Big Brother' as 'entertainment' ... a non-classical use of the term.</div>
</div>
<div><br /></div>
<div>I ask because I'm writing an exam with a question about whether a 2D array with mixed data types is possible (or wise).</div>
<div><br /></div>
<div>Cheers</div>
<div>Mark</div>
<div><br /></div>
</div>
<div class="gmail_extra">
<br /><div class="gmail_quote">On 12 June 2015 at 14:09, Laurie Savage <span dir="ltr"><<a href="mailto:08327998@pvgc.vic.edu.au">08327998@pvgc.vic.edu.au</a>></span> wrote:<br /><blockquote style="margin:0px 0px 0px .8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid;" class="gmail_quote">
<div dir="ltr">
<div>If it quacks like an array ...? Could you elaborate on why Python lists ain't arrayz?<br /><br /></div>Laurie<br /></div>
<div class="gmail_extra">
<br clear="all" /><div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Laurie Savage<br /><a href="https://sites.google.com/a/pvgc.vic.edu.au/mr-savage/home">https://sites.google.com/a/pvgc.vic.edu.au/mr-savage/home</a><br /></div></div></div></div></div></div></div></div></div></div>
<br /><div class="gmail_quote">On 12 June 2015 at 13:27, Mark <span dir="ltr"><<a href="mailto:mark@vceit.com">mark@vceit.com</a>></span> wrote:<br /><blockquote style="margin:0px 0px 0px .8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid;" class="gmail_quote">
<div dir="ltr">Hi, codemakers.<div><br /></div>
<div>Most languages require all elements of an array to have a single data type, but I have a nagging suspicion that there is an exception or two.</div>
<div><br /></div>
<div>e.g Apparently PHP allows mixed data types in its 'arrays' but I believe PHP 'arrays' are actually more like the lists found in Perl or Python and so are not classical arrays.</div>
<div><br /></div>
<div>Is there a language that allows true arrays with mixed data types?</div>
<div><br /></div>
<div>Cheers</div>
<div>Mark<span><font color="#888888"><br clear="all" /></font></span><div><br /></div>-- <br /><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">
<div><i><br /></i></div>
<div>
<span style="font-size:12.66px;">Before Facebook, how many people would take a picture of their dinner on a disposable camera, get the photos developed, then go round to your friends' houses and show them all the photo?</span><br /></div>
<div><span style="font-size:12.66px;"><br /></span></div>
<div>-- </div>
<div><br /></div>
<div>Mark Kelly</div>
<div>
<br /></div>
<div><a href="http://vceit.com">http://vceit.com</a></div>
</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>
</div>
<br />_______________________________________________<br /><a href="http://www.edulists.com.au">http://www.edulists.com.au</a> - FAQ, Subscribe, Unsubscribe<br />
IT Software Development Mailing List kindly supported by<br /><a href="http://www.vcaa.vic.edu.au">http://www.vcaa.vic.edu.au</a> - Victorian Curriculum and Assessment Authority and<br /><a href="http://www.vcaa.vic.edu.au/vce/studies/infotech/softwaredevel3-4.html">http://www.vcaa.vic.edu.au/vce/studies/infotech/softwaredevel3-4.html</a><br /><a href="http://www.vitta.org.au">http://www.vitta.org.au</a> - VITTA Victorian Information Technology Teachers Association Inc<br /><a href="http://www.swinburne.edu.au/ict/schools">http://www.swinburne.edu.au/ict/schools</a> - Swinburne University<br /></blockquote>
</div>
<br /></div>
<br />_______________________________________________<br /><a href="http://www.edulists.com.au">http://www.edulists.com.au</a> - FAQ, Subscribe, Unsubscribe<br />
IT Software Development Mailing List kindly supported by<br /><a href="http://www.vcaa.vic.edu.au">http://www.vcaa.vic.edu.au</a> - Victorian Curriculum and Assessment Authority and<br /><a href="http://www.vcaa.vic.edu.au/vce/studies/infotech/softwaredevel3-4.html">http://www.vcaa.vic.edu.au/vce/studies/infotech/softwaredevel3-4.html</a><br /><a href="http://www.vitta.org.au">http://www.vitta.org.au</a> - VITTA Victorian Information Technology Teachers Association Inc<br /><a href="http://www.swinburne.edu.au/ict/schools">http://www.swinburne.edu.au/ict/schools</a> - Swinburne University<br /></blockquote>
</div>
<br /><br clear="all" /><div><br /></div>-- <br /><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">
<div><i><br /></i></div>
<div><span style="font-size:1266px;">>> Witty sig goes HERE <<</span></div>
<div><br /></div>
<div>Mark Kelly</div>
<div>
<br /></div>
<div><a href="http://vceit.com">http://vceit.com</a></div>
</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>
</blockquote></body></html>