I have been writing PHP for a number of years but in a procedural style. I have always shied away from object oriented PHP because I just didn't understand it. However now I'm back for another go.I have a large web application which is written in procedural style PHP and as a learning exercise I would like to re-write it entirely in object-oriented PHP.So before I start coding away thinking I'm doing the right thing, I would like to help, tips, and advice on what I have written so far. I don't think I need to explain what I am doing here because it is pretty simple stuff and self-explanatory.pdo.inc.php<?php$host = localhost;$db = dev;$user = dev;$pass = dev;$dsn = mysql:host=$host;dbname=$db;;try{    $pdo = new PDO($dsn, $user, $pass);} catch (PDOException $ex) {    echo 'Connection failed: ' . $ex->getMessage();    die();}?>customer.class.php<?phpinclude_once('pdo.inc.php');class Customers{    function GetCustomerName($pdo, $customer_id)    {        $query = SELECT first_name FROM Customers WHERE customer_id = :customer_id LIMIT 1;        $stmt = $pdo->prepare($query);        $stmt->bindParam(':customer_id', $customer_id);        $stmt->execute();        return $stmt->fetchColumn();    }}?>test.php<?phpinclude_once('customers.class.php');$a = new Customers();echo $a->GetCustomerName($pdo, 1);?>Having looked at a number of PHP OOP tutorials it seems people use try/catch differently. I have seen some people use the try/catch within the class's method, and some people call the method from within the try/catch. What's the recommended usage of try/catch?
Simple customer SQL query using a class and function
php;php5;pdo