How to extract the value by providing the key of an array in php [duplicate]

混江龙づ霸主 提交于 2019-12-11 06:48:07

问题


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] => 
        )

) 

回答1:


Just call:

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


来源:https://stackoverflow.com/questions/40926522/how-to-extract-the-value-by-providing-the-key-of-an-array-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!