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

Insights that
helps you grow

  • 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…
  • Case study: How Lender Orka Ventures Scaled Affiliate Operations
    Orka Ventures, an online lending group that wanted to scale fast across countries and onboard affiliates quickly. Their custom affiliate API and tracking layer soon…