Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Official ZPE/YASS documentationSystem variable

The system variable as it is known, was added in version 1.7.4 of ZPE/YASS and is designed to hold information about several things. More than anything, it is to avoid the over complication of adding several functions to perform the same thing.

The system variable is an associative array global variable that contains several values such as the number of processors available to the system, the line separator for the operating system, the current working directory, the document root, the script start time, the executable path, the operating system information and much more.

Using the system variable is easy:

YASS
//Will print the whole system variable
print($_SYSTEM)
    

The output from this should be the standard style of output from an associative array, which matches the key to value pairs in an unordered set.

Using ZPE 1.7.5's beautify function, the display can be much cleaner and easier to read:

YASS
//Will print the whole system variable
print(beautify($_SYSTEM))
    

The result would look more like:

SCRIPT_PATH => /zpe-exec
CWD => /Users/zpe
START_TIME => Thu Mar 28 12:35:52 GMT 2019
HOME_DIR => /Users/zpe
DOCUMENT_ROOT => /Users/zpe
AVAILABLE_PROCESSORS => 32
EXEC_PATH => /Users/zpe/Programs/ZPE

For example, it would be relatively straight forward to obtain the time at which some script was executed using the $_SYSTEM variable:

YASS
//Will print the hour when the script started
print($_SYSTEM['START_TIME']->hour())
    
Comments
Feedback 👍
Comments are sent via email to me.