LLMS_Database_Query::sanitize_id_array( mixed $ids = array() )
Sanitize input to ensure an array of absints
Description Description
Parameters Parameters
- $ids
-
(mixed) (Optional) String/Int or array of strings/ints
Default value: array()
Return Return
(array)
Source Source
File: includes/abstracts/abstract.llms.database.query.php
protected function sanitize_id_array( $ids = array() ) { if ( empty( $ids ) ) { $ids = array(); } // allow numeric strings & ints to be passed instead of an array if ( ! is_array( $ids ) && is_numeric( $ids ) && $ids > 0 ) { $ids = array( $ids ); } foreach ( $ids as $key => &$id ) { $id = absint( $id ); // verify we have ints if ( $id <= 0 ) { // remove anything negative or 0 unset( $ids[ $key ] ); } } return $ids; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.15.0 | Introduced. |