3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ "id" => 54, "type" => 5, "content" => [ ["id" => 99, "type" => 516], ["id" => 88, "type" => 464], ["id" => 41, "type" => 845] ] ], [ "id" => 54, "type" => 55, "content" => [ ["id" => 54, "type" => 578], ["id" => 54, "type" => 354], ["id" => 75, "type" => 458] ] ], [ "id" => 65, "type" => 59, "content" => [ ["id" => 87, "type" => 5454], ["id" => 65, "type" => 245], ["id" => 65, "type" => 24525] ] ] ]; $id = 54; $type = 55; foreach ($array as &$row) { if ($row["id"] == $id && $row["type"] == $type) { break; } } $row['content'] = 'this has been changed'; var_export($array);

preferences:
76.87 ms | 1501 KiB | 5 Q