LLMS_Abstract_Query::sanitize_id_array( string|int|array $ids = array() )

Sanitize input to ensure an array of absolute integers.


Parameters Parameters

$ids

(string|int|array) (Optional) String/Int or array of strings/ints.

Default value: array()


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/abstracts/llms-abstract-query.php

	protected function sanitize_id_array( $ids = array() ) {

		if ( empty( $ids ) ) {
			return array();
		}

		// Allow numeric strings & ints to be passed instead of an array.
		$ids = ! is_array( $ids ) ? array( $ids ) : $ids;

		// Force positive ints.
		$ids = array_map( 'absint', $ids );

		// Remove empty values.
		return array_values( array_filter( $ids ) );

	}

Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Moved from LLMS_Database_Query abstract.
3.24.0 Unknown.
3.15.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.