简体   繁体   中英

camelCase methods, under_score method parameters

Here's a function declaration that belongs to PHP's PDOStatement class:

public function bindValue ($parameter, $value, $data_type = 'PDO::PARAM_STR')

It demonstrates something peculiar about the coding style that the PDOStatmenet and a few other PHP classes use - method names (as well as class and instance variables) use camelCase while parameter variables - under_score.

Does this coding style follow any particular coding / naming convention?

The PHP Framework Interoperability Group (FIG) created a standard PSR-1 (Basic coding standard for PHP which aims to ensure a high level of technical interoperability between shared PHP code.). This douments this style of formatting for class constants and methods. Please see section 4 of the guide .

FIG was formed in 2009 and is formed of a number of developers of PHP frameworks . They convene and develop standards to improve interoperability and coding style between frameworks. They are not an 'official' standard but the aim is to influence a large cross-section of the PHP community. In my opinion, this standard is very firmly established in the world of PHP5.3+.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM