Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7692003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:45:09+00:00 2026-05-31T20:45:09+00:00

Most of the time when I need to wrap some code onto the next

  • 0

Most of the time when I need to wrap some code onto the next line I have a preferred way of doing it. For example when calling a method I like to :

someMethod(
    param1,
    param2,
    param3
);

but when it is a method definition I can’t find a way that reads intuitively. EG

function someMethod(
    param1,
    param2,
    param3) {

    // code here. 
    // Problem : The parameters are indented at the same level as the code
}

function someMethod(param1,
                    param2,
                    param3) {

    // code here
    // Looks ugly. Pain to re-factor
}

public function someMethod(param1, param2, param3
         param4, param5, param6) {

    // code here
    // I've included public to show that I am using 8 spaces here and not
    // lining up with the end of the function keyword.
 }

I’m leaning towards the last example, but am not very happy with it. It works ok with the opening brace on the end as here, but if the brace is in line with the function keyword it looks ugly. eg

function someMethod(param1, param2, param3) 
         param4, param5, param6)
{

    // code here
}

Edit: I’m primarily asking about PHP, but I’ve had this problem in other languages.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:45:10+00:00Added an answer on May 31, 2026 at 8:45 pm

    I suggest you to follow a coding standard. There are many good and popular ones.

    In my particular case, I program in PHP, so Zend and Pear come to my mind. Also, if you aren’t programming on a team, then coding style is mostly something of your particular taste and being consistent.

    Anyway, in those standards they recommend something like this:

    function somemethod(param1, param2, param3
        param4, param5, param6
    ) {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Most of the time, I am doing this way. class a { public: ~
Here's a piece of code that takes most time in my program, according to
For a particular segment of Java code, I'd like to measure: Execution time (most
What is the best/most time efficient way to insert 1000 rows into one table
Any time I need to write code I almost always put it in the
I have a huge line-separated text file and I want to make some calculations
I have some image processing Java code in Android that acts upon two large
I use LogMeIn primarily because most of the time I need to access files
I'm doing some unit tests where essentially I need the input stream to block
I have a large set classes which I need to wrap in a very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.