wpseek.com
WordPress开发者和主题制作者的搜索引擎
rest_validate_array_contains_unique_items › WordPress Function
Since5.5.0
已弃用n/a
› rest_validate_array_contains_unique_items ( $input_array )
参数: |
|
返回: |
|
定义在: |
|
文档: |
Checks if an array is made up of unique items.
源码
function rest_validate_array_contains_unique_items( $input_array ) { $seen = array(); foreach ( $input_array as $item ) { $stabilized = rest_stabilize_value( $item ); $key = serialize( $stabilized ); if ( ! isset( $seen[ $key ] ) ) { $seen[ $key ] = true; continue; } return false; } return true; }