19
Usually for checks that modify only one line I have avoided the use of keys, because PHP accepts this method, but I rarely see codes from other programmers like this... Examples
My method
if($thumb->SaveInDB('imagens','img'))
$ok = true;
else
$ok = false;
Normal method
if($thumb->SaveInDB('imagens','img'))
{
$ok = true;
}
else
{
$ok = false;
}
Does it make any difference to use the "{ }" keys in such cases? is there the possibility of php returning error or something like?
It still works. I use keys for organization.
– user3677610
The answers from @Diegovieira, bfavaretto and gpupo complement each other well... I think it would be nice if someone included in their reply references the others to make the answer well complete :D
– RodrigoBorth
related: https://answall.com/questions/162974/qual-a-diferen%C3%A7a-entre-os-usos-do-foreach-no-php
– Daniel Omine