0
votes
3answers
165 views

Javascript Naming Convention [closed]

I've been using Javascript for quite a while, but I've always ignored the common naming conventions that I see online (camelCase). I know it all depends on the developer's preference, but why camel ...
0
votes
1answer
120 views

Should the helper function in class be defined before the usage or after

I need to do the code review of fellow members. One of the member always defined the helper functions at the bottom and use them at top e,g class Sample { public function SendFile(){ file = ...
0
votes
2answers
459 views

Good or bad code? Or “a secret reason”?

I think this code: if(file_exists("amodule.inc.php")) require_once("amodule.inc.php"); is misleading because of the use of the require_once. I think that - to keep the logic and "wording" ...
1
vote
2answers
211 views

Arguments for conforming to PSR-2

I am trying to convince the lead developer of an open-source project I'm contributing to, to conform to the PSR standards (PSR-2 in particular) created by the PHP Framework Interop Group. He is ...
3
votes
3answers
445 views

Avoiding boilerplate in PHP classes

I am working on a PHP code and as it grows getting more and more tired of repeating the same standard pattern again and again and again: class BolerPlate { protected $property1; protected ...
3
votes
2answers
272 views

Are there standard style guides for PHP?

I've been working in a very small team for PHP development and we've been using an ad-hoc, "Invented Here" style guide. Now that our team and codebase is growing, we would like to use a more ...
-3
votes
1answer
704 views

Why do some programmers prefer spaces over tabs? [duplicate]

Possible Duplicate: Why do some languages recommend using spaces rather than tabs? While reading over the style guides for PHP PSR-0 PSR-1 PSR-2 I noticed the rule Code MUST use 4 ...
4
votes
5answers
501 views

How can I avoid mistakes using the same variable name again?

This isn't a rare case and occurs with me often and I spent countless time trying to debug the code. Latest example, this PHP code where I used $email for the parameter and for object as well. ...
-5
votes
2answers
431 views

Is there any reason why I should use parentheses when calling new in PHP?

When there are no arguments, we have these two options: $obj = new MyClass; vs. $obj = new MyClass(); I always pick the former, just because. Any thoughts?
6
votes
5answers
584 views

Are SQL Injection vulnerabilities in a PHP application acceptable if mod_security is enabled?

I've been asked to audit a PHP application. No framework, no router, no model. Pure PHP. Few shared functions. HTML, CSS, and JS all mixed together. I've discovered numerous places where SQL injection ...
4
votes
1answer
276 views

Is '@' Error Suppression a Valid Technique for Testing for an Optional Array Key?

Rarst and I were debating offline about the use of the '@' error suppression operator in PHP, specifically for use to test for existence of "optional" array keys, i.e. array keys that are being used ...
1
vote
1answer
177 views

Namespaces and naming

I'm having some trouble working this one out, probably more than I should. This is a pretty large project, with a very clearly defined structure, with no obvious problems, but I can't seem to figure ...
4
votes
2answers
464 views

Why are people afraid to die()?

I have seen a lot of people (first comment) hating die(); instead of exit; As the follow-up comments on that post note, die and exit are the same - the attitude appears to be one of perception, with ...
1
vote
6answers
3k views

PHP: brackets or no brackets with if/for/while/…?

Both these syntaxes are correct and equivalent: With brackets: foreach ($listOfThings as $thing) { echo $thing; } Without brackets: foreach ($listOfThings as $thing): echo $thing; endforeach; ...
3
votes
5answers
1k views

How to not mix HTML with PHP?

I made an application in EXTJS, but my technical architect and project manager say we don't want big file, so removed the EXTJS and made in object oriented PHP and JavaScript code, mixing HTML with ...
1
vote
3answers
396 views

PHP ORM style of querying

Ok so I have made an ORM library for PHP. It uses syntax like so: *(assume that $business_locations is an array)* Business::type(Business:TYPE_AUTOMOTIVE)-> ...
0
votes
1answer
192 views

Tips for a novice PHP developer to drive down long-term maintenance costs

I'm an experienced Java developer who is just starting up a project for an NGO. I will be working on the project for at least 6 months, following which the NGO will have to pay or find a volunteer to ...