su_is_positive_number

The shortcodes-ultimate su is positive number function.

Published Date - February 15, 2021

Description

Helper function to check if a passed value is a positive number.

su_is_positive_number( $value );

Parameters

  1. $value


Usage

The following example is for adding a hook callback.

if ( !function_exists( 'su_is_positive_number' ) ) {
    require_once ABSPATH . PLUGINDIR . 'shortcodes-ultimateshortcodes-ultimate/includes/functions-helpers.php';
}

// The input(s). 
$value = null;

// NOTICE! Understand what this does before running.
$result = su_is_positive_number( $value );
            

Defined

The function is defined in the following location(s).

shortcodes-ultimate/includes/functions-helpers.php

function su_is_positive_number( $value ) {

	if ( ! is_string( $value ) && ! is_int( $value ) ) {
		return false;
	}

	if ( ! ctype_digit( (string) $value ) ) {
		return false;
	}

	return (int) $value > 0;

}