DEV Community

Discussion on: PHP array functions (Exposed)

Collapse
 
samuraiseoul profile image
Sophie The Lionhart

Hey mate, pretty thorough article but there were a few mistakes or slightly misleading comments in a lot of your explanations. I'm not going to go into all of them as many of them I think were minor English problems(your English is very good though, don't get discouraged!) and also they were possibly more helpful in thinking about the array function while learning than the 100% low level explanations.

The one big thing that does stick out to me though is this:

In PHP and in programming in general, an array is a set of data elements that are stored under a unique name.

In programming in general an array is list of elements listed sequentially in memory. The index of the array is always numerical and while in dynamic languages and such the following isn't true in lower languages the index is the number that you multiply times the size of the data type in memory and add to the starting point in memory of the array to find that element. That's why arrays start at zero as well.

Additionally arrays are lists, and not sets. A set is a specific data structure that contains each value only once even if added multiple times.

Lastly in PHP, arrays are not arrays, php doesn't really have arrays. Everything is an associated array, which is really a map which maps a index to a value. PHP has done a lot of nice things under the hood to have these maps function like arrays a lot of the time, but at the end of the day they are not true arrays by any stretch of the word. :( Its sad cause sometimes all you want is a real array.

Anyways good post and keep them coming! These will help eventually clear some of the un-warranted negativity towards PHP in the developer community! :D

Collapse
 
anastasionico profile image
anastasionico

Hi Scott, Thanks a lot, These are great tips for the reader of this post...
and great insight, as you guessed I am not a native speaker and since this kind of post requires quite a technical language, is not so easy for me.
I hope I can help somebody anyway.
Thanks for your feedback

Collapse
 
samuraiseoul profile image
Sophie The Lionhart

Like I said don't get discouraged and you did great! Technical language in a foreign language is really hard! I speak Japanese and Korean and am starting to learn Spanish, and could most likely for the first two languages live in those countries with close to no problems day to day. However, I still have trouble or just plain can't speak about anything technical, scientific, or academic. That's some of the hardest content to really get I think in a foreign language!

So you're doing great and I respect what you've done here! Kick some ass mate!

Thread Thread
 
anastasionico profile image
anastasionico

I am almost in tear haha,
Joking aside thanks a lot for your support. It helps me keeping up with my language improvement and content creation process.