<?php $aNumbers = [ 1 => 'one', 2 => 'two', 3 => 'three',]; $oKey = new stdClass(); $bInArray = in_array($oKey, $aNumbers); var_dump($bInArray); $bInArray = in_array((string) $oKey, $aNumbers);
Standard input is empty
bool(false)
PHP Catchable fatal error: Object of class stdClass could not be converted to string in /home/lyL0Ij/prog.php on line 15
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!