Skip to main content

float

Vasyl MartyniukLess than 1 minute

Syntax

(*float)${...}
(*float)<numeric-string>

Examples

  • (*float)${USER.current_balance} - Converts current user's balance to a float number
  • (*float)2.1 - Converts '2.1' string to 2.1 float number

Definition

Treat provided value as a float value. Under the hood, the PHP core floatvalopen in new window function parses the value.

The following example displays a teaser message on all posts that below to the category "Premium Content" (slug "premium-content") if user has balance less than $6.79.

{
    "Statement": {
        "Effect": "deny",
        "Resource": "Term:category:premium-content:posts",
        "Action": "Read",
        "Metadata": {
            "Teaser": {
                "Value": "You current balance ${USER.current_balance} is less than minimum $6.79"
            }
        },
        "Condition": {
            "Less": {
                "(*float)${USER.current_balance}": 6.79
            }
        }
    }
}