<?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;
You have javascript disabled. You will not be able to edit any code.