Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 185636

Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.

18 votes
Accepted

Is my PHP login system following best practices? Is the code really OOP?

This is a pretty good attempt at a login system. The code looks much better than 99% of code that I see on Stack Overflow. Keep up the good work! Your code is almost clean. Your classes do so little t …
Dharman's user avatar
  • 881
1 vote

Should i throw exceptions in the service layer or repository, and catch it on the controller?

Throw an exception when your code can't proceed the happy path without some information, or prerequisites. For example, in a hypothetical method makeSale(int $userId) you would throw an exception if t …
Dharman's user avatar
  • 881
1 vote

PHP OOP: Configuring MySQL DB & query w/ Twig

You really should use an autoloader. Either Composer autoloader or the PHP built-in one. Your close_db_connection method is useless, you can safely remove it. You have no reason to prematurely close …
Dharman's user avatar
  • 881
5 votes
Accepted

Connect to MYSQL database in PHP with prepared statements

Sam's answer covers a lot of good points I am not going to repeat, but I will tell you more issues. Private properties What is the point in setting constants as private properties? What is the purpose …
Dharman's user avatar
  • 881
4 votes

OOP - Contact Form PHP Backend - Procedural to OOP - Dynamic MySQL Prepared Statement PHP

There are a lot of things wrong with your code, but none of them should cause performance or security issues. The main thing you are doing is you are using prepared statements. Of course, I would high …
Dharman's user avatar
  • 881