Naming conventions

Script names

Although not required, it recommended that you use '.phpw' instead of '.php' as the extension for your main WinBinder script files. This way it will be easier for a programmer or final user to spot which is the main WinBinder file from a list of PHP scripts. Also, you -- or better, an installer program -- may associate the PHPW extension with php-win.exe so your scripts can get executed automatically just by double-clicking the file name on Windows Explorer. In case you are wondering, the additional 'W' stands for 'Windows', of course.

The WinBinder main script is called winbinder.php.

WinBinder auxiliary scripts begin with the prefix 'wb_'. Examples:

Function names

WinBinder function names always begin with the wb_ prefix, are followed by a verb, then possibly an underscore and one or more nouns separated by additional underscores, all in lowercase characters. Examples:

While some functions are generic, others apply only to windows, controls, items or other objects. In this case, the particle window, control, etc. should be included in the function name. Example:

WinBinder uses certain conventions for naming functions. For example, all functions that set object attributes start with the particle wb_set. Examples are wb_set_text(), wb_set_value(), and wb_set_image(). According to this convention, the function that shows or hides a window should be (and is) named wb_set_visible(), not wb_show(). This helps to maintain consistency and allows function names to be easily recalled.

Constant names

Control and window class constants use "studly caps" with all words starting with a capital letter:


Other constants are uppercase only and should generally begin with the prefix WBC_:


There are still other constants that do not conform to these rules. Some examples are:


See also

Function parameters and return values