如何通过在php中提供数组的键来提取值 [英] How to extract the value by providing the key of an array in php

查看:122
本文介绍了如何通过在php中提供数组的键来提取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从数据库中检索了以下结果集.如何在 employeeName 键中提取值?

I have the following result set retrieved from the database. How should i extract the value in the employeeName key?

Array
(
    [0] => Array
        (
            [id] => 2
            [employeeName] => John
            [designation] => Assistant Accountant
            [rlevel] => Level 3
            [comments] => LOL
            [employeeCompany] => BDL
            [employeeCompanyCode] => 
            [uNo] => 41201
            [uCompany] => BOD
            [employeeNo] => 
        )

) 

推荐答案

只需调用:

$value = $array[0]["employeeName"];

这篇关于如何通过在php中提供数组的键来提取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆