check object type php
class MyClass {
}
$o1 = new MyClass();
$o2 = new MyClass();
$name = 'MyClass';
// in the cases below, $a gets boolean value true
$a = $o1 instanceof MyClass;
$a = $o1 instanceof $name;
$a = $o1 instanceof $o2;
// counter examples:
$b = 'b';
$a = $o1 instanceof 'MyClass'; // parse error: constant not allowed
$a = false instanceof MyClass; // fatal error: constant not allowed
$a = $b instanceof MyClass; // false ($b is not an object)
gettype($u)<?php
/*
*
* opcode number: 138
*/
$obj = new A();
if ($obj instanceof A) {
echo 'A';
}
?>
Also in PHP:
- creat laravel project
- change from all caps to sentence case in php
- TEXT UPPER PHP
- add zeros in front of number php
- base64_decode laravel
- codeigniter delete record by id
- codeigniter echo last query
- current date() in php
- ampps php mkdir recreate
- current date into time
- Backend fatal error: PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted in laravel 8
- Redirection page php
- change format date usa month text php
- artisan cache clear
- can i throw exception in catch block php
- encryption key has not encrypted laravel
- What was the old name of PHP?
- echo console.log
- e_notice in php
- PHP debug console print
- current date function in php
- check if contains ph
- base64 encode and decode in php
- PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Sp ecified key was too long; max key length is 1000 bytes")