开发者

Get a value of returned array

开发者 https://www.devze.com 2023-01-12 06:48 出处:网络
How can I write this code in one php operator? $menu = theme(\'nice_menu\', 1, 10, \'down\'); print $menu[\'content\'];

How can I write this code in one php operator?

$menu = theme('nice_menu', 1, 10, 'down');
print $menu['content'];

Something like this:

prin开发者_如何学Pythont theme('nice_menu', 1, 10, 'down')['content'];


Not on a production version of PHP. This has been added to the trunk for the next version (Currently called 5.3.99DEV, but it's unsure if it'll be 5.4 or 6.0 or what)... It's called Array Dereferencing. See the RFP...


This is, unfortunately, not possible (at the current state of PHP). Your first example is the way to do it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号