3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ["url" => 'fareham', "value" => 'Fareham'], ["url" => 'southampton', "value" => 'Southampton'] ]; $needle = 'fareham'; $haystackColumn = 'url'; $returnColumn = 'value'; $value = null; foreach ($array as $row) { if ($row[$haystackColumn] === $needle) { $value = $row[$returnColumn]; break; } } echo $value;

This is an error 500

There are `>1` results


preferences:
136.82 ms | 1087 KiB | 7 Q