Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to lookup value object php

function lookup($array, $key) {

    //loop through all values in array
    foreach($array as $values) {

        //if 'key' value matches `$key`, return 'value' value.
        if($values['key'] == $key) {
            return $values['value'];
        }

    }

    //if nothing has been returned, return empty string
    return "";
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #lookup #object #php
ADD COMMENT
Topic
Name
3+5 =