I see that you have a lot of great detailed answers, but to make it really simple:
You know what a code block is.
You know that if you want to reuse a block of code, you put it in a function.
So far, so good. Now classes are devoted to organizing functions and variables.
If you create many functions, you must be very careful that their names do not collide, and you probably want to organize your functions in separate files in order to group related related functions.
At its simplest, Classes help group related functions into one class of functions. Instead
add_product_to_shop(); add_product_to_cart(); add_product_to_wish_list();
you group them inside a class:
Shop::addProduct(); Cart::addProduct(); WishList::addProduct();
Here Shop , Cart and WishList are classes, each of which has its own addProduct() method (function). This is a small improvement over another piece of code, since the function names themselves have become much shorter, it is obvious that the functions are not designed to work together, and it is easy to add other related functions to one class.
Other classes also allow you to not only group a function together, but also variables. Variables are often worse than functions when it comes to naming, as you need to be very careful not to rewrite variables. By grouping them all in their respective classes, you have less name conflicts. (A related concept is also called a namespace.)
Which classes also allow you to create objects from them. If the class is a plan of related variables and functions, you can build an “actual object” from this plan, even several that act independently, but behave the same. Instead of tracking $shopping_cart1 and $shopping_cart2 and making sure your functions act on the right variable, you simply make a copy of your plan:
$cart = new Cart(); $cart->addProduct($x); $anotherCart = new Cart(); $anotherCart->addProduct($y);
You do not need this very often in web development, especially PHP, but depending on your application this may be useful.
Which classes additionally allow you to slightly modify them. Say you have created a large collection of features that act together as a shopping cart. Now you want to create another shopping cart, which basically works the same, but has some slight differences (say, discounts should be calculated immediately). You can create a new class and specify that it should act exactly the same as in the old shopping cart, but override and modify several specific variables or functions (this is called Inheritance).
There are many more features that the Classes concept gives you, and each of the above items entails a lot more details and features. In general, Classes are used to keep things together that belong to each other, keep things apart that should be separated from each other (namespacing), simplify sequence checking (getters / seters, check variables before replacing them) and much more ...