Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Array = ( "a" => "b", "b" => "c", "c" => "y", "d" => "z" ); Output: c and d
请告诉我如何循环一个将找到他们最后一个父链接的数组。很难描述问题,但请查看预期输出。
提前致谢!:)
我相信您想要的是一个函数,它将返回所有键的值不在数组键中。您可以使用该array_keys()功能 ( docs ) 和in_array()( docs )。
array_keys()
in_array()
function independantKeys( $arr ) { $output = Array(); $keys = array_keys( $arr ); foreach( $arr as $key => $val ) { if( !in_array( $val, $keys ) ) { $output[] = $key; } } return $output; }