Answer the question
In order to leave comments, you need to log in
Declaring variables using curly braces?
I came across a blog post by one team about how they vehemently reduce the amount of code .
Everything would be fine, but the look caught on the design
<font color="black"><font color="#0000ff">if</font>(!${0}) log(<font color="#A31515">'Writing failed'</font>);</font><br/>
Answer the question
In order to leave comments, you need to log in
The use of curly braces allows you to refer to an identifier with a variant name.
Simple example:
$name = 'value';
$value = 'test';
echo ${$name}; // выведет test
$name = 'propertyName';
echo $object->{$name};
> if(!${0}) log('Writing failed');
Idiots wrote code
Gone are the days of saving bytes.
now there are byte cachers (accelerators) that cache the opcode, so this saving is not effective.
the code must be understandable first of all to the programmer, and then to the machine.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question