As a brand new php developer, i know the advantages of OOP over the procedural php. Things like inheritance, polymorhism and better performance with maintanable, reusable and more organised code.
My question here is that:
Are there any situations in professional programming, that OOP is not necessary? or situations that the procedural php has advantages over the OOP?
In other words, in professional programming, OOP is the only road? and procedural php is only for newbies? or there are exceptions?
There are actually three major paradigms: procedural, object oriented and functional. And in real project each file in your codebase be somewhere on that triangle.
As for purely procedural code - it's most often used in various maintenance scripts, when you need to make something quick and simple. For example: "delete all empty shopping baskets, that were made by anonymous visitors and are more that hour old". It's something you run once per .. emm .. year, or when someone in DevOps start crying.
The point of OOP is not to "make code better", but to add more constraints, which let large codebases to be maintainable.
You should watch this quick video to stop worrying about it: Programming With Anthony - Paradigm Soup.
And I would also recommend this lecture for some additional in-sight in the pointlessness of worrying about it :D