I’ve got a object instance and I retreive from him some method:
$object->getWebUserInfo($id)
It returns some typical array:
array(29) { [“username”]=> string(7) “quardas” [“password”]=> string(32) “PASS” [“id”]=> string(2) “19” [“internalKey”]=> string(2) “19” [“name”]=> string(0) “” [“fullname”]=> string(0) “” [“role”]=> string(1) “0” [“email”]=> string(17) “quardas@somemail.com” [“phone”]=> string(0) “” [“mobilephone”]=> string(0) “” [“blocked”] … etc
Is it possible to get certain key’s value in one line code? (Wihtout make additional value which keeps this array) – e.g.
$object->getWebUserInfo($id)->{'username'}
of course that above doesn’t work
Dereferencing of arrays from methods and functions is not supported in your version of PHP. You could, however, typecast the return value to an object and access the items like object members: