lp__init_int( $value, $filter_value_on_failure=false )

This function initializes an integer value based on the given input value. It uses the PHP filter_var() function with the FILTER_VALIDATE_INT filter.

Plugin

Namespace

Launchpad

Parameters

mixed

$value

The value to be initialized as an integer.

int | bool

$filter_value_on_failure

Value to return on failure to initialize as an integer.

Return

int

The initialized integer value.

Source

File: \includes\lp-utility-functions.php

function lp__init_int( $value, $filter_value_on_failure=false ){
    $intval = filter_var($value, FILTER_VALIDATE_INT);
    return $intval !== false ? $intval : $filter_value_on_failure;
}

Related

Use to initializes an integer value based on the given input value.

Used to to retrieve the value of a property from an object.