require_once('db.php'); $email = 'john@example.com'; $user = DB::get_one('users', ['email' => $email]); print_r($user); // Output: ['id' => 1, 'name' => 'John Smith', 'email' => 'john@example.com']
require_once('db.php'); $post_id = 1; $post = DB::get_one('posts', ['id' => $post_id]); print_r($post); // Output: ['id' => 1, 'title' => 'Lorem Ipsum', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.']This function is commonly used in PHP frameworks such as Laravel or CodeIgniter, but it is not limited to any particular library or package.