<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
set_error_handler(function (int $severity, string $message, string $filename, int $line) {
echo "throwing\n";
throw new ErrorException($message, 0, $severity, $filename, $line);
});
$stdObject = new stdClass(); //Can't be casted to string
//array_diff compares array items CASTING them to string
//http://php.net/manual/en/function.array-diff.php
try {
array_diff([$stdObject], [$stdObject]);
}catch(ErrorException $ee){
echo "Catched exception: " . $ee->getMessage() . "\n";
}
echo "\n----------\n";
try {
array_diff([$stdObject], [$stdObject]);
}catch(ErrorException $ee){
echo "Catched exception: " . $ee->getMessage() . "\n";
}
preferences:
69.81 ms | 402 KiB | 5 Q