Variables

SunSed variables are containers for storing values (data). They may hold any of SunSed supported data types (string, integer, arrays and etc.)

Creating Variables

Variables should always start with a $ sign.

The name of the variable follows the $, and it may start either with an underscore or a letter, never a number. After the first character, the remainder of the variable name may contain numbers too.

# valid variable names:
$x          = ...
$user_name  = ...
$x_of_200   = ...
$user2      = ...
$_user_name = ...

# valid but not recommended
$userName = ...

# instead use: 
$user_name

# invalid variable names:
$2user       = ...
$-movie-name = ...
$movie-name  = ...

NOTE: Variable names that start with a number are invalid.

# invalid variable declaration
$1 = 1
#=> ERROR

Variable names are case sensitive, meaning you may use $user, $USER, or $UsEr, however, they are treated as different variables.

Copyright ©2013-2022 SunSed®. All rights reserved.