how to lookup value inside object php
$array = [
'clothes' => 't-shirt',
'size' => 'medium',
'color' => 'blue',
];
extract($array);
echo("$clothes $size $color"); // t-shirt medium blue
how to lookup value inside object php
$array = [
'clothes' => 't-shirt',
'size' => 'medium',
'color' => 'blue',
];
extract($array);
echo("$clothes $size $color"); // t-shirt medium blue
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 "";
}
how to lookup value object php
$fruit = json_decode($fruit, true);
lookup($fruit, 'key');
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us