3v4l.org

run code in 300+ PHP versions simultaneously
<?php $jobTiers = array("tier_1" => array("jobs_to_inc" => 10, "jobs_to_dec" => 8), "tier_2" => array("jobs_to_inc" => 20, "jobs_to_dec" => 16)); $jobCount = 10; $test = array_walk_recursive($jobTiers, function($arr) use ($jobCount) { // I want it to return the array where jobCount is in-between jobs_to_dec and jobs_to_inc if (!($jobCount >= $arr['jobs_to_dec'] && $jobCount <= $arr['jobs_to_inc'])) unset(current($jobTiers)); //return ($jobCount >= $arr['jobs_to_dec'] && $jobCount <= $arr['jobs_to_inc']) ? $arr : false; }); var_dump($jobTiers);
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.19
Fatal error: Can't use function return value in write context in /in/3Hgv7 on line 9
Process exited with code 255.

preferences:
175.83 ms | 1395 KiB | 55 Q