tribe_null_or_number( mixed $value = null )

Validation of Null or Numerical values for Shortcode Attributes.

We don’t use absint() since -1 is a common number used to indicate "all" or "infinite".


Parameters #

$value

(mixed) (Optional) Which value will be validated.

Default value: null


Top ↑

Return #

(int|null) Sanitizes the value passed as an integer or null.


Top ↑

Source #

File: src/functions/utils.php

	function tribe_null_or_number( $value = null ) {
		if ( null === $value || 'null' === $value ) {
			return null;
		}

		return (int) $value;
	}

Top ↑

Changelog #

Changelog
Version Description
4.13.2 Introduced.