Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

is_a()

is_a() is a PHP native function, that checks if an object is of a specific class.

Usually, is_a() is better replaced by instanceof, which is a PHP operator. The function might be needed to create a closure, though.

<?php

    $object = (object) ['a' => 1];

    var_dump(is_a($object, stdClass::class));

?>

Documentation

See Also