// Example 1: Retrieving user information using get_by_name method in PHP function get_user_by_name($name){ $conn = mysqli_connect("localhost", "username", "password", "mydb"); $sql = "SELECT * FROM users WHERE name='$name'"; $result = mysqli_query($conn, $sql); $user = mysqli_fetch_assoc($result); mysqli_close($conn); return $user; } $user_info = get_user_by_name("john_doe"); // Example 2: Retrieving user information using an ORM library (Package/Library) require_once 'vendor/autoload.php'; use Illuminate\Database\Capsule\Manager as DB; $user = DB::table('users')->where('name', 'john_doe')->first();The first example is a PHP function that uses mysqli (MySQL Improved Extension) to connect to a database and retrieve user information through an SQL query. This approach is commonly used in standalone PHP applications. The second example shows the use of an ORM (Object Relational Mapping) library named "Illuminate\Database\Capsule\Manager" which is part of the Laravel framework. It enables developers to interact with the database in an object-oriented way without necessarily writing SQL queries. This is commonly used in modern PHP web applications.