Back to Help Index

Using PHP Calculations


These should only be attempted by people with programming familiarity

  • You can use ( ) + - / * > < == != "
  • An equal check is ==
  • A not equal check is !=
  • "and" is &&
  • "or" is ||
  • Use "" or NULL to unset a value depending on the field type
  • Do not use $variables - insert field-tokens instead
  • Do not add "<?" or a semicolon to the end
  • For a carriage return use "\n"

Simulate Vars can be completed using Podio data to debug complex calculations.

You can use the following PHP functions

date - Format a local time/date
strtotime - Parse about any English textual date format into a Unix timestamp
mktime - Get Unix timestamp for a date

number_format - Format a number with grouped thousands

abs - Absolute Value
min - Find lowest value
max - Find highest value
ceil - Round fractions up
floor - Round fractions down
rand - Generate a random integer
sqrt - Get the square root
round - Rounds a float (value to a specified precision)
intval - Get the integer value of a variable
floatval - Gets the float value of a variable
serialize - Generates a storable representation of a value
unserialize - Creates a PHP value from a stored representation

chr - Returns a specific character in a string
strip_tags - Strip HTML and PHP tags from a string
strip_tags_gf - Strip HTML and PHP tags from a string retaining carriage returns and list items
strtolower - Make a string lowercase
strtoupper - Make a string uppercase
ucwords - Uppercase the first character of each word in a string
ucfirst - Make a string's first character uppercase
explode - Split a string by string
implode - Join array elements with a string
nl2br - Inserts HTML line breaks before all newlines in a string
stristr - Find the first occurrence of a string
strlen - Get a string length
substr - Returns part of a string
strpos - Find the position of the first occurrence of a sub-string in a string
stripos - Find the position of the first occurrence of a case-insensitive substring in a string
strrpos - Find the position of the last occurrence of a substring in a string
str_replace - Replace all occurrences of the search string with the replacement string
strval - Get string value of a variable
substr_count - Count the number of substring occurrences
trim - Strip whitespace (or other characters) from the beginning and end of string
sprintf - Return a formatted string

urlencode - URL-encodes string
rawurlencode - URL-encode according to RFC 3986
base64_encode - Encodes data with MIME base64
base64_decode - Decodes data encoded with MIME base64
htmlspecialchars_decode - Convert special HTML entities back to characters
html_entity_decode - Convert all HTML entities to their applicable characters
json_decode - Decodes a JSON string
json_encode - Returns the JSON representation of a value

current - Return the current element in an array
sizeof - Alias of count - Count all elements in an array, or something in an object
array_slice - Extracts a slice of an array
array_diff - Computes the difference of arrays
in_array - Checks if a value exists in an array
array_unique - Removes duplicate values from an array

preg_replace - Searches subject for matches to pattern and replaces them with replacement.
preg_match_gf - Searches subject for a match to the regular expression given in pattern.

For real life calculation examples Click Here

A good resource to play with php is: WritePHPOnline

Or check out the PHP Manual at:

Back to Help Index