Unary operators

Unary operators increment or decrement values instantly. These operators are frequently used in For loops, which are described later in this chapter:

# Initialize variable
$a = 1

# Increment after
$a++ # 2

# Decrement after
$a-- # 1

# Increment before
++$a # 2

# Decrement before
--$a # 1
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset