Instead of php-mode you can try web-mode. It supports php very well and seemed to indent correctly your example.
Edit: In order to make flycheck parses php, add the following to your web-mode-hook:
(flycheck-mode 1) (flycheck-add-mode 'php 'web-mode)
 
                 
                                             
                         
                        
manpreet![Tuteehub forum best answer]() Best Answer
                                                
                                                                                                        3 years ago
                                                    Best Answer
                                                
                                                                                                        3 years ago
                                                
                                            
I have the latest Emacs and php-mode setup and this code does not get indented correctly
Instead it looks like this
Note both the last line and that it indents the
echowith 8 spaces instead of 4.I've tried M-x
php-enable-psr2-coding-stylebut it still doesn't work.