SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2008
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Function/Coding Convention

    Hi All,

    In the process of learning PHP and coming from a Java/Perl background.

    In Java convention for functions (methods in Java) is myFunction. In perl it is my_function.

    I have noticed in PHP, however, that the standard convention is my_function, but myFunction is also used from time-to-time.

    Is there any standard PHP coding convention or is it an either-or sort of thing?

  2. #2
    SitePoint Guru rageh's Avatar
    Join Date
    Apr 2006
    Location
    London, Formerly Somalia
    Posts
    612
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by qaz216 View Post
    Hi All,

    In the process of learning PHP and coming from a Java/Perl background.

    In Java convention for functions (methods in Java) is myFunction. In perl it is my_function.

    I have noticed in PHP, however, that the standard convention is my_function, but myFunction is also used from time-to-time.

    Is there any standard PHP coding convention or is it an either-or sort of thing?
    Have a look at this coding standard
    ------------------

  3. #3
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    My method is camelcaps: myFunction()

    All peoperties of an object are first-letter capitalised, and all of the params passed are lowercase first letter.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •