3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sortedScores = [ ['student_id' => 2, 'total_score' => 443], ['student_id' => 4, 'total_score' => 410], ['student_id' => 1, 'total_score' => 371], ['student_id' => 3, 'total_score' => 170], ]; foreach($sortedScores as $idx => $row) $sortedScores[$idx]['rank'] = $idx+1; var_export($sortedScores);

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
165.63 ms | 1779 KiB | 9 Q