The fetchAll() method returns an array containing all of the remaining rows in the result set.
Unlike the fetch method, which reads row by row, fetchAll captures all data at once and
stores it in a multidimensional array. This is very convenient for smaller tables, as you can get all information
with a single call and then easily process it using a foreach loop.
Practical Application: We use the fetchAll method when we want to store the data
from the database into a variable for later use in a template or when we need to convert the data into JSON format.
Check the process at home by following these steps:
users table with five test records exists within the pdo_db
database.