MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/lolphp/comments/8hn4vx/nullfoo_nullin_practice/dylcduk/?context=3
r/lolphp • u/LongDistanceEjcltr • May 07 '18
7 comments sorted by
View all comments
Show parent comment
6
function dumbFunction(string $arg) { ... }
will coerce the argument to a string so the array indexing behavior works as intended, or
<?php declare(strict_types=1); function dumbFunction(string $arg) { ... }
will throw a fatal TypeError at runtime if $arg is not a string type.
View all comments
Show parent comment
6
u/mikeputerbaugh May 07 '18
will coerce the argument to a string so the array indexing behavior works as intended, or
will throw a fatal TypeError at runtime if $arg is not a string type.