Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はこのようなことをしたいと思います:
class CCC {} function abc(array of CCC $variable)
これはphpで可能ですか?
いいえ。
手動で確認する必要があります:
function foo(array $arr) { if (array_filter($arr, function ($i) { return !($i instanceof CCC); })) { throw new InvalidArgumentException('Array must contain instances of CCC'); } ... }