CKTIS / PHP
is_object()
Erkennt jedes Objekt einschließlich Closure und stdClass.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
is_object(mixed $value): boolErkennt jedes Objekt einschließlich Closure und stdClass. Ein Array mit denselben Feldern bleibt ein Array. Wenn eine bestimmte Methode nötig ist, prüfe das passende Interface mit instanceof.
Signatur
is_object(mixed $value): bool
Ausgabe des Beispiels
[true,true,false,false]
Beispiele
<?php
echo json_encode([is_object(fn()=>1), is_object((object)["id"=>3]), is_object(["id"=>3]), is_object(null)]);
Ergebnis
[true,true,false,false]