Is there a name for a language feature that allows assignment/creation?
- by Alex Mcp
This is a bit hard for me to articulate, but in PHP you can say something like:
$myArray['someindex'] = "my string";
and if there is no index named that, it will create/assign the value, and if there IS an index, it will overwrite the existing value.
Compare this to Javascript where today I had to do checks like so:
if (!myObject[key]) myObject[key] = "value";
I know this may be a bit of a picky point, but is there a name for the ability of PHP (and many other languages) to do these checks on their own as opposed to the more verbose (read: PITA) method of Javascript?