In no way shape or form am i advertising/promoting my programming style, but as far as 'multiple variable declarations' are concerned, which case is more acceptable professionally and commonly:
case 1:
private $databaseURL = "localhost" ;
private $databaseUName = "root" ;
private $databasePWord = "" ;
private $databaseName = "AirAlliance";
case 2:
private $databaseURL = "localhost";
private $databaseUName = "root";
private $databasePWord = "";
private $databaseName = "AirAlliance";
The reason i like case 1 is because i can skim though it and see that all is correct way faster than case 2. Also i can visually get familiar with variable names witch makes it faster to work with them l latter on the program.
Whichever style the project is already using, so you don't end up spending all day fixing every file you touch.
case 1.5:
private $databaseURL = "localhost";
private $databaseUName = "root";
private $databasePWord = "";
private $databaseName = "AirAlliance";
I don't think aligning the semicolons makes it any more readable, it just makes it annoying to change the value of one of the strings and then have to add or delete spaces to line up the semicolons all over again.
In this case, it looks like the variable names are unlikely to change, so it should be OK to line up the equals signs. If it were possible that the variable names would change, however, I would go with case 2 because (again) it would be annoying to have to line everything up again. (Imagine the work involved in simply adding a new variable called $databaseLongVariableName.)
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