webCOMAND

cScript Variables

cScript provides several features and functions to check, access and update variables, including numbers, text and dates and times.

Example

// set and manipulate numbers: 1 + 2 = 3
$a = 1;
$b = 2;
$c = $a + $b;
echo("$a + $b = $c");

// set and manipulate text: Hello, World!
$a = 'Hello' + ', ';
$b = 'World';
$b += '!';
$a$b

// set and manipulate dates: Dec 20, 1975
$a = '1975-12-08';
adjustdate($a, 'DAY', 12);
format($a, '%b %e, %Y');

// get a variable by reference: Hi
$a = 'Hi';
$b = 'A';
ref($b)

// working with arrays: 3
$a = ['three', 2];
$a[2] = 1;
count($a);

// working with strings as arrays: h
$string = 'three';
echo($string[2]);