R
R
rkfddf2021-03-03 15:33:00
PHP
rkfddf, 2021-03-03 15:33:00

How to understand php datatype as object?

I often see how a class or an interface is set as the type of arguments or return type. Something like this. 603f80f4372bb496559297.png
Or, I cut out two figures, in which the interface is declared as a type. 603f8130baffe319322945.png
603f813d00fbf146417450.png
How to understand such a data type, what is obtained from the object as a value of the type, how can you be sure that what was intended will be pulled from the class? Well, I don't understand this at all. Tell me where to look, what to read.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
part_os, 2021-03-03
@rkfddf

If two classes implement the same interface, then you can use instanceof to understand which class came from and, depending on this, call the necessary actions.
https://www.php.net/manual/en/language.operators.t...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question