to-int

The to-int operation converts the input value into an integer (whole number). This is useful when you need numeric values in a clean, standardized format for calculations, conditions, or API requests.

How it works

  • String containing a number
    • “42” → 42
    • “1.25” → 1 (decimal part removed)
  • Float
    • 1.25 → 1
    • -3.9 → -3
      (the decimal part is truncated, not rounded)
  • Boolean
    • true → 1
    • false → 0
  • Null
    • null → 0
  • Other types (arrays, objects, resources)
    • Not supported — results in an error.

Examples

InputResult
“42”42
“1.25”1
1.251
-3.9-3
true1
false0
null0
[1,2,3]❌ Error

Usage in PalDock

Use to-int when you need to:

  • Normalize numeric fields before sending them to APIs that require integers.
  • Strip decimals when only whole numbers are accepted.
  • Convert boolean-like values into numeric flags (true → 1, false → 0).
  • Ensure that empty or null values default to 0.

Best Practices

  • Remember that decimals are truncated, not rounded (2.9 → 2).
  • Text that is not numeric will cause an error. Validate or sanitize your input first.
  • Use this operation only when the target field should always be a whole number.

References

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

Related articles

Modify Field > combine
Modify Field > urldecode
Modify Field > urlencode
Modify Field > load-from-lead
Modify Field > regex-replace
Modify Field > from-base64
Modify Field > to-base64
Modify Field > modify-date
Modify Field > format-date
Modify Field > do-not-send

Insights that
helps you grow