3v4l.org

run code in 300+ PHP versions simultaneously
<?php $topics = [ [ "id" => 1, "statusName" => "COMPLETED", "lessons" => [ [ "id" => 1, "statusName" => "COMPLETED" ], [ "id" => 1, "statusName" => "COMPLETED" ], ] ], [ "id" => 2, "statusName" => "SCHEDULED", "lessons" => [ [ "id" => 1, "statusName" => "SCHEDULED" ], [ "id" => 1, "statusName" => "COMPLETED" ], ] ] ]; foreach ($topics as $key => $value) { $topics[$key]['lessons'] = array_map(function ($lesson) use ($value) { $lesson['reschedule'] = true; return $lesson; }, $value['lessons']); } var_dump($topics);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(3) { ["id"]=> int(1) ["statusName"]=> string(9) "COMPLETED" ["lessons"]=> array(2) { [0]=> array(3) { ["id"]=> int(1) ["statusName"]=> string(9) "COMPLETED" ["reschedule"]=> bool(true) } [1]=> array(3) { ["id"]=> int(1) ["statusName"]=> string(9) "COMPLETED" ["reschedule"]=> bool(true) } } } [1]=> array(3) { ["id"]=> int(2) ["statusName"]=> string(9) "SCHEDULED" ["lessons"]=> array(2) { [0]=> array(3) { ["id"]=> int(1) ["statusName"]=> string(9) "SCHEDULED" ["reschedule"]=> bool(true) } [1]=> array(3) { ["id"]=> int(1) ["statusName"]=> string(9) "COMPLETED" ["reschedule"]=> bool(true) } } } }

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:
74.49 ms | 408 KiB | 5 Q