3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ (object) ['id' => 'one', 'color' => 'white'], (object) ['id' => 'two', 'color' => 'red'], (object) ['id' => 'three', 'color' => 'blue'] ]; $find = 'one'; var_export( array_find( $array, fn($row) => $row->id === $find ) );
Output for 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
(object) array( 'id' => 'one', 'color' => 'white', )
Output for 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30
Fatal error: Uncaught Error: Call to undefined function array_find() in /in/llvFp:12 Stack trace: #0 {main} thrown in /in/llvFp on line 12
Process exited with code 255.

preferences:
53.86 ms | 851 KiB | 4 Q