My preferred style is

function function_name()
{
    if($statement)
    {
        $code_goes_here=1;
        $code_line_2=1;
    }
}

So curly braces on new lines, tab indents. Not fussed one way or the other about spaces in the lines. I just want blocks of code to line up inside their respective curly braces.

When I start a function or code block its fine, I press enter, open the curly braces and press enter again, the braces are lined up where they should be and the cursor is in the right place for the code. Except as soon as I put in the ; to end the line, the whole line gets pushed back to be in line with the curly braces.
eg.

if($statement)
{
$code_goes_here=1;
}

I move it back where it belongs and press enter, cursor is in the place I want it but again when I put in the ; the indent for that line gets removed

    Hello,

    Thank you for your post.

    There is automatic formatting turned on by default when you press ; but it should not kill the indenting.
    Does it happen in all files or in some specific file? Is there just PHP or also something else like HTML or JS?

    Thank you

      All files and its just PHP in the file

        Do you have any other extension installed that might interact here?

          a month later

          Is this still happening in the latest release?

          Thank you

            Write a Reply...