Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

is_object()

Check for any object, including a closure or stdClass.

Version: PHP 8.4; repository runtime, production runtime not attested

Syntax

is_object(mixed $value): bool

Check for any object, including a closure or stdClass. An array holding the same fields remains an array. Use instanceof or an interface when a downstream operation depends on a specific method.

Signature

is_object(mixed $value): bool

Example output

[true,true,false,false]

Examples

<?php
echo json_encode([is_object(fn()=>1), is_object((object)["id"=>3]), is_object(["id"=>3]), is_object(null)]);

Result

[true,true,false,false]

Sources