<?php

define('SOMETHING', true);    

class ExampleClass {
    private static $var = array("hi");

    public static function exampleFunction() {
        if(SOMETHING) {
            self::$var[] = "hello";
        }
    } //I print out this change and it works, containing both hi and hello

    public static function getVar() {
        return self::$var;
    } //this does not return the updated array, only the original with hi

}

// add hello to the array ExampleClass::$var
ExampleClass::exampleFunction();

// get $var
$var = ExampleClass::getVar();

var_dump($var);