Is there an equivilent of c#'s #region in PHP?
PHP, originally derived from Personal Home Page Tools, now stands for PHP: Hypertext Preprocessor, which the PHP FAQ describes as a "recursive acronym." PHP executes on the server, while a comparable alternative, JavaScript, executes on the client.
PHP is an open-source server-side scripting language that many devs use for web development. It is also a general-purpose language that you can use to make lots of projects, including Graphical User Interfaces (GUIs).
PHP is known to be the most frequently used programming language. According to W3Techs, 78.8% of all websites are using PHP for their server-side. Interesting fact: PHP originally stood for Personal Home Page. Now PHP is widely known and thought of as Hypertext Preprocessor.
No.
The thing is, C# is sort of designed to be written by only one IDE, because Microsoft need you to always use their tools. So, built into the language (sort of) are things that affect the IDE.
PHP, on the other hand, is just a language. It's not supposed to have a symbiotic relationship with some specific editor, so it doesn't. So, no, it has nothing to control your editor.
Still, all proper programming text editors support folding class definitions, function definitions, and most scope blocks. Some editors may allow certain extensions to go beyond this.
No, there's nothing directly in the language.
But every decent editors allow some kind of markup to allow this.
For example in Netbeans :
// <editor-fold defaultstate="collapsed" desc="user-description"> ...any code... // </editor-fold>
This syntax also works in all the Intellij IDEA editor family, see http://blog.jetbrains.com/webide/2012/03/new-in-4-0-custom-code-folding-regions/
You can also emulate the feature in Eclipse via a plugin : Code folding plugin for Eclipse?
Visual Studio Code includes it since version 1.19 :
#region user description ...any code... #endregion
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With