# Phi: example usage

Any basic expression, filter or operator from Twig will work in Phi, for example:

```n = -12
print(n|abs)		#12

print(1 is odd)		#true
print(1 is even)	#false

colour = 'Red'
t = "my car is #{colour}"

print(t)			#"my car is Red"
print(t|lower)		#"my car is red"
print(t|upper)		#"MY CAR IS RED"
print(t|capitalize)	#"My car is red"
print(t|title)		#"My Car Is Red"

r = t|replace({car: 'van'})
print(r)			#"my van is Red"

x = 1y = 2
t = "#{x} plus #{y} is #{x + y}"
print(t)					#"1 plus 2 is 3"

n = 1.234e7
print(n|number_format)		#"12,340,000"

numbers = [4, 5, 6]
print(numbers|join(','))	#"4,5,6"

fruit = "apple,banana,cherry"
print(fruit|split(','))		#["apple", "banana", "cherry"]

t = '  Hello world '
print(t starts with 'H')	#false
print(t ends with 'd')		#false
t = t|trim
print(t) #"Hello world"
print(t starts with 'H')	#true
print(t ends with 'd')		#true

print(t matches '/hello/')	#0
print(t matches '/Hello/')	#1
print(t matches '/hello/i')	#1
print('Hello' in t)			#true
print('Hi' in t)			#false```

Lines should not end in a semicolon or other terminator, but should just have a new-line.

Note that Twig's environment functions such as `constant()`, `include()`, `parent()` and `source()` do not work in Phi.