Suddenly I don’t want to do anything, I feel like I’m an uncle. . But I can’t break the habit of blogging every working day. . So let’s drink some water today.
I have been using PHP for almost 2 years, but this is the first time I saw this thing. Suddenly, I feel that I have fallen back into the ranks of the five scum.
Open the official document "Type Constraints" and it is very clear.
There are four kinds in total: class name, interface, array, callable (from PHP 5.4)
those things Neither int string will work. .
Examples and other examples are already explained in great detail in the PHP manual, and I am too lazy to write them down. Anyway, this thing is just a knowledge point, you will know it after just reading it. .
Actually, I haven’t written PHP for a long time. Now I look back and read the major frameworks. I really doubt that I really know PHP.