3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rows = [ ['id' => 21, 'text' => 't1', 'Mon' => 1], ['id' => 22, 'text' => 't2', 'Mon' => 0], ['id' => 23, 'text' => 't3', 'Mon' => 1], ]; $rowsResult = []; foreach($rows as $index => $row){ if($row['Mon'] == 1){ $rowsResult [$index] = $row; } } var_dump($rowsResult);

preferences:
59.89 ms | 402 KiB | 5 Q