Possible Duplicate:
How to find the value from this array in php?
hello coders.I have an array like this
Array
(
[0] => Array
(
[0] => admin/login
[1] => LoginHandler
[2] => index
)
[1] => Array
(
[0] => post
[1] => PostHandler
[2] => index
)
[2] => Array
(
[0] => post/create
[1] => postHandler
[2] => create
)
[3] => Array
(
[0] => post/update
[1] => postHandler
[2] =>开发者_运维知识库; update
)
[4] => Array
(
[0] => post/delete
[1] => postHandler
[2] => delete
)
)
I want only the values like admin/login, LoginHandler,index,
post,PostHandler,index
,
post/create,PostHandler,create
and so on.So how to do that?
You can loop through the array to perform an action on each element:
foreach ( $your_array as $element ) {
if ( is_array( $element ) ) {
foreach ( $element as $sub_element ) {
// You can store this value in a variable, or output it in your desired format.
echo $sub_element . "<br />";
}
}
else {
echo $element . "<br />";
}
}
精彩评论