Posts Categorized: OOP

Parsing WordPress wp-config.php file

Posted by & filed under OOP, Wordpress.

I need a script to extract the database details from the wp-config.php file so I could keep the logon details in one location when I was coding something outside the WP framework. I came up with a class that does this, connects to mysql and selects the database. There are three connection options: PDO, mySQLi… Read more »

PDO – bindParams vs. bindValues

Posted by & filed under OOP.

I was trying to supply binding params to a PDO query like this: However, this will not work. From the PHP manual – “Unlike PDOStatement::bindValue(), the variable is bound as a reference and will only be evaluated at the time that PDOStatement::execute() is called.” So, the correct way to do this would be: See also,… Read more »

Why use OOP when it takes longer?

Posted by & filed under OOP.

Developing using OOP techniques takes longer in the intial code, but is easier to maintain. In the end it will save you time, produce less ‘buggy’ code, and help you write code that is re-usable.

Good OOP habits

Posted by & filed under OOP.

Great article here