note 102449 deleted from function.in-array by cmb

From: Date: Sun, 15 Sep 2019 13:11:18 +0000
Subject: note 102449 deleted from function.in-array by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212198@lists.php.net to get a copy of this message
Note Submitter: Joris Meijer ---- A good option if your array contains objects and you wish to recursively search it (eg. with in_arrayr), is to use json_encode and json_decode first: <?php $array = json_decode(json_encode($array_with_objects), true); ?> In my opinion this is more elegant than a recursive in_array function which converts the objects into arrays while searching for a key and/or value.

« previous php.notes (#212198) next »