Suppose I have a conditional statement without brackets in a function:
function get_user_id()
{
if ($something) $this->some_function($str);
return array('user_id' => $user_id);
}
I think bracketless statements are bad practice... I want to add brackets to the if-statement but where does the statement end? Does is it end at the first semicolon or the end of the function?
Which is correct:
function get_user_id()
{
if ($something)
{
$this->some_function($str);
}
return array('user_id' => $user_id);
}
or..
function get_user_id()
{
if ($something)
{
$this->some_function($str);
return array('user_id' => $user_id);
}
}