3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ (object)[ 'driver_id' => 2, 'total' => 308, 'total_driver' => 5, 'score1' => 61.6000, 'score2' => 62, ], (object)[ 'driver_id' => 3, 'total' => 354, 'total_driver' => 5, 'score1' => 70.8000, 'score2' => 71, ], ]; $array2 = [ [ 'driver_id' => 2, 'recommendation_min' => 0, 'recommendation_max' => 50, 'recommendation_key_range' => 'Low', 'recommendation_observation' => 'Low', 'recommendation_' => 'Low', ], [ 'driver_id' => 2, 'recommendation_min' => 51, 'recommendation_max' => 78, 'recommendation_key_range' => 'Moderate', 'recommendation_observation' => 'Moderate', 'recommendation_' => 'Moderate', ], ]; var_export( array_map( fn($obj) => (object)array_merge( array_find( $array2, fn($row) => $obj->driver_id == $row['driver_id'] && $obj->score2 >= $row['recommendation_min'] && $obj->score2 <= $row['recommendation_max'] ) ?? [], (array)$obj ), $array1 ) );
Output for git.master_jit, git.master
array ( 0 => (object) array( 'driver_id' => 2, 'recommendation_min' => 51, 'recommendation_max' => 78, 'recommendation_key_range' => 'Moderate', 'recommendation_observation' => 'Moderate', 'recommendation_' => 'Moderate', 'total' => 308, 'total_driver' => 5, 'score1' => 61.6, 'score2' => 62, ), 1 => (object) array( 'driver_id' => 3, 'total' => 354, 'total_driver' => 5, 'score1' => 70.8, 'score2' => 71, ), )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
56.98 ms | 406 KiB | 5 Q