DEV Community

PHP 0 to hero pt.4 - Variables, constants, arrays, superglobals

Mateusz Jasiński on December 14, 2023

Welcome back - Today we will be learning about one of the most important concepts of programming - storing data I won't make this intro too long -...
Collapse
 
joolsmcfly profile image
Julien Dephix

Hi.

Nice intro!

I'd just point out that by convention constant do not have a leading $.
So instead of

const $CONSTANT = 5;
Enter fullscreen mode Exit fullscreen mode

you should write

const CONSTANT = 5;
Enter fullscreen mode Exit fullscreen mode

I have seen so many people confused with arrays so I think it would help if you showed the PHP code for the array with Foo's and Bar's that's on your image.
And said image should have indices that start at 0 so you could show that
$mDimArr[1][2] points to Bar3.

Collapse
 
wizarddos profile image
Mateusz Jasiński

Hi, thanks for the feedback

I have to admit, that I hadn't really tested the constants, so thanks for pointing it out

Rest if fixed by now, I changed the table and an example code a little bit

I think you have now saved people a bit of time, especially the less experienced once, thank you