Declared a function with an int
variable, passing in an int
. The error falls out:
Catchable fatal error: Argument 1 passed to myTest () must
Why?
myTest(intval(3)); function myTest(int $val){ }
Declared a function with an int
variable, passing in an int
. The error falls out:
Catchable fatal error: Argument 1 passed to myTest () must
Why?
myTest(intval(3)); function myTest(int $val){ }
In php5. * Type hinting, in the function declaration, you can check only for an array or a specific class, scalar types are entered only in php7. * - http://php.net/manual/en/migration70.new-features.php
Source: https://ru.stackoverflow.com/questions/455253/
All Articles
ΠΠΎΠ½ΡΡΠΎΠ»Ρ ΡΠΈΠΏΠ° Π½Π΅ ΠΌΠΎΠΆΠ΅Ρ Π±ΡΡΡ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ ΡΠΎ ΡΠΊΠ°Π»ΡΡΠ½ΡΠΌΠΈ ΡΠΈΠΏΠ°ΠΌΠΈ, ΡΠ°ΠΊΠΈΠΌΠΈ ΠΊΠ°ΠΊ int ΠΈΠ»ΠΈ string. Π Π΅ΡΡΡΡΡ ΠΈ Π’ΡΠ΅ΠΉΡΡ ΡΠ°ΠΊΠΆΠ΅ Π½Π΅Π΄ΠΎΠΏΡΡΡΠΈΠΌΡ.
ΠΠΎΠ½ΡΡΠΎΠ»Ρ ΡΠΈΠΏΠ° Π½Π΅ ΠΌΠΎΠΆΠ΅Ρ Π±ΡΡΡ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ ΡΠΎ ΡΠΊΠ°Π»ΡΡΠ½ΡΠΌΠΈ ΡΠΈΠΏΠ°ΠΌΠΈ, ΡΠ°ΠΊΠΈΠΌΠΈ ΠΊΠ°ΠΊ int ΠΈΠ»ΠΈ string. Π Π΅ΡΡΡΡΡ ΠΈ Π’ΡΠ΅ΠΉΡΡ ΡΠ°ΠΊΠΆΠ΅ Π½Π΅Π΄ΠΎΠΏΡΡΡΠΈΠΌΡ.
- BOPOH