to-bool

The to-bool operation converts the input value into a boolean (true or false). This is useful when you need a clear yes/no flag for conditions, routing, or API calls.

How it works

The following values are treated as false:

  • false (already boolean false)
  • 0 (integer zero)
  • 0.0 (float zero)
  • “” (empty string)
  • “0” (string containing zero)
  • [] (empty array)
  • null

All other values are treated as true, including:

  • Any non-zero number (positive or negative)
  • Any non-empty string (even “false” or “0.0”)
  • Any non-empty array
  • Any object or resource

Examples

InputResult
falsefalse
truetrue
0false
-1true
0.0false
“0”false
“false”true
“hello”true
[]false
[0]true
nullfalse

Usage in PalDock

Use to-bool when you need to:

  • Normalize form inputs (e.g., interpret checkbox-like fields as true/false).
  • Guarantee a boolean value before a Condition or Router element.
  • Send proper boolean values in API requests (true/false instead of text or numbers).

Best Practices

  • Remember that the string “0” is the only non-empty string treated as false.
  • The string “false” is considered true (because it is non-empty). If you need to handle “true”/”false” text literally, normalize the string first.
  • Empty arrays are false; arrays with at least one item are true.

References

https://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.castinghttps://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting

Insights that
helps you grow

  • Release notes 2026/02/27
    After months of work, our Integration Builder has a fresh new look and a lot more power. We redesigned it to be easier to use,…
  • Release notes 2025/12/19
    We added country-based categorization. You can now categorize offers, integrations, and other items by a specific country, or keep them global across all markets. We also…
  • Release notes 2025/12/17
    More flexible lead rejection: based on validation rules, filters, or pingtree sales results, by source (iframe, API) or by partner (include / exclude). It is now possible to…