3
votes
3answers
443 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 ...
-2
votes
1answer
253 views

Coding standards in programming? [closed]

I am an WordPress Plugin Developer. I am not sure how to follow the coding standard while creating a plugin of wordpress. I check with some of the plugins like woocommerce and All in one SEO Plugin in ...
5
votes
4answers
692 views

In MVC is it considered good practice to have private, non-action, functions in a controller class?

Sometimes action functions in the controller class can become huge and nasty, with many-many lines of code to simply control the flow of data from the Model to the View. At some point these huge ...
3
votes
4answers
547 views

Reusable VS clean code - where's the balance?

Let's say I have a data model for a blog posts and have two use-cases of that model - getting all blogposts and getting only blogposts which were written by specific author. There are basically two ...
7
votes
3answers
1k views

What is the difference (if any) between (null != $object) and ($object != null) when using PHP?

I am used to Java and therefore always think conditions are interpreted from left to right, i.e. there is a vital difference in null != $obj and $obj != null Now this seems not to be the case with ...
3
votes
3answers
422 views

Is there a limit on how many global consts are used before an application is considered bad programming?

Basically, I develop websites, some large with many crud operations, etc... However I've gotten into the habit of storing re-usable data as a constant in my PHP applications I currently have 44 ...
1
vote
1answer
168 views

Condition based function declarations

I recently came across a weird piece of code if(foo == bar){ function foo_bar(){ // Function definition } } Is this a good practice of coding ?
8
votes
2answers
605 views

Are there any good use-cases for variable variables?

Today I encountered this little PHP gem called variable variables. $literal = "Hello"; $vv = "literal"; echo $$vv; // => prints "Hello" Are there actually any real use-cases for this language ...
3
votes
5answers
731 views

How to convince my boss to switch to OOP PHP? [closed]

We have been trying for months to convince my boss to switch to OOP php, but each time, he takes out his previous experience with programming and convinces us other wise. i need to talk like a boss ...
1
vote
3answers
425 views

Formatting PHP, what works more efficiently?

I was just wondering what makes PHP work faster. I have a few methods that I always go and do, but that only improves the way I can read it, but how about the interpreter? Should I include the curly ...