I am studying PHP and Python and I am feeling a huge difficulty, not in relation to concepts, after all they are independent of language, what is making the study hard is how PHP implements the manipulation of its objects, follows an example :
// Em PHP
>>> $frase = "Lorem ipsum";
>>> echo str_replace(" ", "<br/>", $frase); // "lorem<br/>ipsum"
# Em Python
>>> frase = "Lorem ipsum ...";
>>> print(frase.replace(" ", <br/>))
Whenever you start your studies in OOP, the information that repeats the most is:
In object orientation, a class is a description that abstracts a set of objects with similar characteristics. More formally, it is a concept that encapsulates data abstractions and procedures that describe the content and behavior of real-world entities, represented by objects. Otherwise, a class can be defined as a description of the properties or possible states of a set of objects, as well as applicable behaviors or actions to these same objects.
Then because when trying to access data in, for example, arrays and others, or even modify its state, I must use functions and not methods which in my view would make sense to be defined in a class and used as method.
I want to emphasize here that what I am saying may be wrong (after all, if I were right I would not be asking), I would like you to remedy my doubts as to why the implementation of the two is so different.